What are the Slack Archives?
Itβs a history of our time together in the Slack Community! Thereβs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonβt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hello. Where do I put module js and scss? Either in Pyz/Zed/MyModule/assets/js / Pyz/Zed/MyModule/as
Comments
-
public/assets contains files that are generated during frontend build
0 -
So, that means, I put js and scss in Pyz/Zed/MyModule/assets/js/myModule.js and Pyz/Zed/MyModule/assets/scss/main.scss, right?
0 -
Its a zed gui module which extends the core Zed module ProductCategory
0 -
giovanni.piemontese Technical Lead @ LΓΆffelhardt Spryker Solution Partner Posts: 871 π§π»βπ - Cadet
Hi Alexey,
just create on project levelbackend/build.js
const oryx = require('@spryker/oryx'); const oryxForZed = require('@spryker/oryx-for-zed'); const { join } = require('path'); const customContext = process.cwd(); const projectPath = '/src/'; const myCustomZedSettings = Object.assign({}, oryxForZed.settings, { ...oryxForZed.settings, entry: { ...oryxForZed.settings.entry, dirs: [ ...oryxForZed.settings.entry.dirs, join(customContext, projectPath) ] } }); oryxForZed.getConfiguration(myCustomZedSettings).then(configuration => oryx.build(configuration));
then in
package.json
just replace the zed build something like so:"zed": "node ./backend/build", "zed:watch": "node ./backend/build --dev", "zed:development": "node ./backend/build"
and then u can just put your js or css as the same as in vendor.. and the zed build will compile js and css take care on your project level extension or new entry point etc...
0 -
giovanni.piemontese Technical Lead @ LΓΆffelhardt Spryker Solution Partner Posts: 871 π§π»βπ - Cadet
z.B so...
0 -
Just great. Thats exactly what I was looking for the whole time. Unfortunately it seems not to be documented in docs. Thank you very much, @UL65CH0MC, I will try and drop a message afterwards.
0 -
~So. The build works. But the css from the Pyz/Zed/ProductCategory/assets/scss/main.scss~
body { background-color: red; }
~is still not compiled together with vendor ProductCategory main.scss. Only the vendor main.css gets compiled, not the project one.~
0 -
It works. Wow.
0 -
giovanni.piemontese Technical Lead @ LΓΆffelhardt Spryker Solution Partner Posts: 871 π§π»βπ - Cadet
@UQS4LDZU7 please put also here the suggested solution from me so everyone know how it works also for css... π
0 -
Yes. Sure.
0 -
So.
0 -
Assume, you have to extend vendor zed module ProductCategory. And you have to add your own css to the vendor one. For that you have to:
0 -
- Follow the @UL65CH0MC down from this message: https://sprykercommunity.slack.com/archives/CKJRJM5FG/p1588843929325100?thread_ts=1588843022.323700&cid=CKJRJM5FG
0 -
- Provide a structure in your Pyz Module like this:
0 -
- provide the content for main.js:
'use strict'; require('../../scss/main.scss');
0 -
- provide the content for +++.entry.js:
'use strict'; require('./modules/main');
0 -
Provide your custom styles for main.css:
0 -
body { background-color: #31b600; }
0 -
then you just run in the console npm run zed
0 -
and check, that both assets (js and css) are generated in public/Zed/assets
0 -
Then you go in zed backend to, say, http://zed.de.spryker.local/product-category/assign?id-category=6
0 -
and see, that body got blue
0 -
thats it.
0 -
giovanni.piemontese Technical Lead @ LΓΆffelhardt Spryker Solution Partner Posts: 871 π§π»βπ - Cadet
thanks!
0 -
thanks back π
0 -
ps. Forgotten. Last step: In the index.twig put the reference to your css file:
{% block head_css %} {{ parent() }} <link rel="stylesheet" href="{{ assetsPath('css/pyz-zed-product-category-main.css') }}" /> {% endblock %}
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 75 Spryker News
- 924 Developer Corner
- 783 Spryker Development
- 88 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 25 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random