Hi team , i want to write js , css for newly creat...
# help
c
Hi team , i want to write js , css for newly created module and use them using assetsPath() .What path i have to use for creating assets and compile them in my custom module for zed back office @wooden-king-30682
l
Hi guys @clean-sundown-47111! • The first, you need to create a new js or css file follow this directory:
src/Pyz/Zed/[YourModule]/assets/Zed/js/example-name.js
• Then, you need to call it from twig file
Copy code
{% block footer_js %}
    {{ parent() }}
    <script src="{{ assetsPath('js/example-name.js') }}"></script>
{% endblock %}
• Run the following commands in order to clear cached and build assets ◦
docker/sdk cli console cache:empty-all
◦
docker/sdk cli npm run zed:watch
• Reload your browser (remember to empty cached on your browser) OR you can go to vendor such as
vendor/spryker/cms-block-gui/src/Spryker/Zed/CmsBlockGui/Presentation/EditGlossary/index.twig
to see the example.
c
i did the same things , but my file is not compiled
l
Did you run
npm install
?
c
I am talking about
docker/sdk cli npm run zed:watch
<- this , after doing that our file compiled to public folder but my file is not in that and i am not able to access it i am getting 404 error in network call
👀 1
When i use <script src="{{ assetsPath('js/example-name.js') }}"></script> in twig so i got error that file not find and basically my file is not compiled or not webpack for using
l
I think that the command
docker/sdk cli npm run zed:watch
was not built successfully. So can you try to run the below commands: •
console frontend:zed:build
•
console frontend:zed:install-dependencies
then run
docker/sdk cli npm run zed:watch
again.
c
is their any other special thing to do for compiling (webpack) our custom module assets, because it is compiling from vendor folder and we are working in src/Pyz directory so is their any things to change in webpack configuration or some else
or we have to register our module some where to compile file
Please help me out i am not able use my js file in my custom created Module in Zed . I follow the same folder structure for creating js , but after runnign the npm run zed my file is not compiled and not moved into public/ folder for using it how can i resolve that @wooden-king-30682 @limited-analyst-99346