ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 10 replies, has 2 voices, and was last updated by Yevhen Shyshkin Yevhen Shyshkin 2 years, 3 months ago.

  • Creator
    Topic
  • #6059
    alendo
    alendo
    Participant

    We are writing an orocrm extension providing some new bundles. We would like to add our css and js files (with our styles and functions) to these bundles, but I don’t understand how to do this. Is it possible? How can I do it?
    thanks
    Alessandra

Viewing 10 replies - 1 through 10 (of 10 total)
  • Author
    Replies
  • #6081
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello, Alessandra.

    JS files should be added using requirejs.yml file, here is example. Also you can look and specific implementations to find out how to work with require.js.

    CSS files should be added using assets.yml file, here is example.

    #6084
    alendo
    alendo
    Participant

    Thanks Yevhen,
    for js do I need to do something else? because I did as you suggested:

    but I cannot find js files in header. Is there another app/console command to install these files?
    Files are correctly deployed on web side with

    For css, I’m working in dev mode and css works only if I set in config_dev.yml

    it’s correct?

    #6093
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    JS:

    1) ensure that your js files are really defined under specified path (bundles/educacloudeducaevent/js/change-status-confirmation.js);

    2) ensure that your JS “educaevent/js/change-status-confirmation” set in dependencies of some loaded module (i.e. should be executed), because in dev environment requirejs modules loaded on demand in realtime, so you will not see them in header; you can use firebug or any debug tool to check list of loaded files;

    3) in prod mode you need to execute oro:requirejs:build to build minified JS that will contain your JS code.

    CSS:

    1) ensure that your CSS registered in assets.yml really exists under specified path, and then clear cache manually or using cache:clear command;

    2) execute assetic:dump command to regenerate all assets including CSS, and don’t forget to clear browser cache.

    General recommendations:

    oro_assetic.css_debug_all can be used during development, but in production all CSS and JS should be compressed in one file to decrease page loading time.

    Also to regenerate all CSS and JS in hard style you can do update, i.e. manually remove cache directories from /app/cache, and then execute oro:platform:update command – it will do all actions described above.

    #8276
    alendo
    alendo
    Participant

    I’m deploying in prod mode and previous deployed js and css don’t work. I followed these steps:

    • I verified that in web/bundles/<mybundle>/js and web/bundles/<mybundle>/css I have my js and css files
    • I verified for js that in requirejs.yml I refer the correct path
    • I verified for css that in assets.yml I refer the correct path
    • I executed in the order:

      # app/console cache:clear --env=prod
      # php app/console assets:install --symlink web
      # app/console oro:requirejs:build # to generate oro.min.js
      # app/console assetic:dump --env=prod # to generate 7946a9a.js and oro.css

    But I have a different behaviour from dev mode and prod mode (in prod mode js doesn't work). Is there an error in my procedure?
    thanks
    Alessandra

    #8277
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello.

    > But I have a different behaviour from dev mode and prod mode (in prod mode js doesn’t work)
    What exactly does not work?

    To make deployment easier you can manually remove cache and run php app/console oro:platform:update --force --symlink --env prod – this command executes all required operations in the correct order.

    #8278
    alendo
    alendo
    Participant

    When I execute

    I have this error on a table of my application

    I’ve seen that also orocrm installers don’t control if the tables already exist before create them.

    #8280
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    > The table with name ‘oro_azienda0.educa_vocabulary’ already exists.
    Look’s like you’ve created this table not via installer/migration – that’s why you have this error. Please, check your migrations. Also you can manully update records in oro_migration table if you sure that appropriate migrations already were executes.

    > I’ve seen that also orocrm installers don’t control if the tables already exist before create them.
    It’s ok – migations must be executed in one specific order, and all executed migrations are shifting version in DB table oro_migration.

    #8281
    alendo
    alendo
    Participant

    Help! We provided all installers for our entities, but there is none of our entities within the table oro_migration! Like those in the following:

    We we install from scratch those installation work correctly, but oro doesn’t track them, I suppose.

    #8282
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    If you have only installers and don’t have migrations – you can use approach with empty installer used in MailChimp bundle https://github.com/orocrm/OroCRMMailChimpBundle/tree/master/Migrations/Schema.

    But still this is an issue and we need to fix it.

    #8293
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    That’s odd, but I can’t reproduce this issue. I’ve created bundle AcmeTestBundle with only one installer in Acme/Bundle/TestBundle/Migrations/Schema/AcmeTestBundleInstaller.php similar to yours – and after instllation I have record about this migration in oro_migration table:

    Then I’ve run platform:update and this installer was not executed:

    I’m using latest master. Could you provide more detailed description about your issue? Maybe you’ve created tables with doctrine:schema:update and then tried to execute platform:update?

Viewing 10 replies - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.