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.
- CreatorTopic
- September 12, 2014 at 12:10 am #24854
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 - CreatorTopic
- AuthorReplies
- September 12, 2014 at 9:22 am #24855September 12, 2014 at 10:24 pm #24856
Thanks Yevhen,
for js do I need to do something else? because I did as you suggested:123456config:paths:'educaevent/js/change-status-confirmation': 'bundles/educacloudeducaevent/js/change-status-confirmation.js''educaevent/js/educaevent': 'bundles/educacloudeducaevent/js/educaevent.js'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 with123php app/console assets:install --symlink webFor css, I’m working in dev mode and css works only if I set in config_dev.yml
12345oro_assetic:css_debug: ~css_debug_all: trueit’s correct?
September 15, 2014 at 2:56 am #24857JS:
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.
January 28, 2015 at 2:49 am #24858I’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
AlessandraJanuary 28, 2015 at 2:58 am #24859Hello.
> 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.January 28, 2015 at 3:19 am #24860When I execute
123php app/console oro:platform:update --force --symlink --env prod but my installersI have this error on a table of my application
1234[Doctrine\DBAL\Schema\SchemaException]The table with name 'oro_azienda0.educa_vocabulary' already exists.I’ve seen that also orocrm installers don’t control if the tables already exist before create them.
January 28, 2015 at 3:29 am #24861> 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.January 28, 2015 at 5:30 am #24862Help! We provided all installers for our entities, but there is none of our entities within the table oro_migration! Like those in the following:
1234567891011121314151617181920212223242526272829303132333435363738394041<?phpnamespace EducaCloud\Bundle\BaseTablesBundle\Migrations\Schema;use Doctrine\DBAL\Schema\Schema;use Oro\Bundle\MigrationBundle\Migration\Installation;use Oro\Bundle\MigrationBundle\Migration\QueryBag;/*** @SuppressWarnings(PHPMD.TooManyMethods)* @SuppressWarnings(PHPMD.ExcessiveClassLength)*/class EducaCloudBaseTablesBundleInstaller implements Installation{/*** {@inheritdoc}*/public function getMigrationVersion(){return 'v1_0';}/*** {@inheritdoc}*/public function up(Schema $schema, QueryBag $queries){/** Tables generation **/$this->createEducaVocabularyTable($schema);$this->createEducaVocabularyTermsTable($schema);$this->createEducacloudEduGoalsTable($schema);$this->createEducacloudProfessionsTable($schema);/** Foreign keys generation **/$this->addEducaVocabularyTermsForeignKeys($schema);$this->addEducacloudEduGoalsForeignKeys($schema);$this->addEducacloudProfessionsForeignKeys($schema);}...We we install from scratch those installation work correctly, but oro doesn’t track them, I suppose.
January 28, 2015 at 6:42 am #24863If 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.
January 29, 2015 at 4:00 am #24864That’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:
12345bap_dev=# select * from oro_migrations where bundle = 'AcmeTestBundle';id | bundle | version | loaded_at----+----------------+---------+---------------------9 | AcmeTestBundle | v1_0 | 2015-01-29 12:49:31(1 row)Then I’ve run platform:update and this installer was not executed:
123456789> php app/console oro:platform:update --force --symlinkProcess migrations...> Oro\Bundle\MigrationBundle\Migration\UpdateBundleVersionMigration> Oro\Bundle\EntityExtendBundle\Migration\RefreshExtendCacheMigration> Oro\Bundle\EntityConfigBundle\Migration\UpdateEntityConfigMigration> Oro\Bundle\EntitySerializedFieldsBundle\Migration\SerializedDataMigration> Oro\Bundle\EntityExtendBundle\Migration\UpdateExtendConfigMigration> Oro\Bundle\ActivityListBundle\Migration\ActivityListMigration> Oro\Bundle\EntityExtendBundle\Migration\UpdateExtendIndicesMigrationI’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?
- AuthorReplies
The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.