OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions Including css and js in orocrm new bundles views

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

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #24854

    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
  • #24855

    Yevhen Shyshkin
    Participant

    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.

    #24856

    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?

    #24857

    Yevhen Shyshkin
    Participant

    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.

    #24858

    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

    #24859

    Yevhen Shyshkin
    Participant

    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.

    #24860

    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.

    #24861

    Yevhen Shyshkin
    Participant

    > 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.

    #24862

    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.

    #24863

    Yevhen Shyshkin
    Participant

    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.

    #24864

    Yevhen Shyshkin
    Participant

    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)

The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.

Back to top