0

I need to run a command to compile my theme styles and commit them every time I need to push something new, these are the commands below.

npm i
gulp style
gulp js

When I try to run it via the Magento Cloud pipeline file, I got a permission issue to create folders and execute Gulp with the automated system.

How could I compile my styles via Magento Cloud pipelines?

1
  • I think you need to contact with Cloud Support
    – Amit Bera
    Commented Jan 15, 2022 at 13:53

1 Answer 1

0

This new npm folder must be a shared folder as your var and pub folders are. To specify that your npm folder is a writable folder, you will need to edit your magento.app.yaml file.

 # The mounts that will be performed when the package is deployed.
mounts:
    "var": "shared:files/var"
    "app/etc": "shared:files/etc"
    "pub/media": "shared:files/media"
    "pub/static": "shared:files/static"
    "node_modules": "shared:files/node_modules"

In the same file, add Node to your dependencies section too.

ruby:
   sass: "~3.4"
nodejs:
   grunt-cli: "~0.3"

Create a bash file where you can easily execute all npm commands you need to run and add them into the build process like this example below.

hooks:
    build: |
        set -e
        npm config get prefix
        ./theme_compiler_install.sh
        ./theme_compiler.sh
        php ./vendor/bin/ece-tools cron:kill
        php ./vendor/bin/ece-tools build:generate
        php ./vendor/bin/ece-tools build:transfer
    deploy: |
        php ./vendor/bin/ece-tools deploy
    post_deploy: |
        php ./vendor/bin/ece-tools post-deploy
        php ./vendor/bin/ece-tools cron:unlock

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.