Platform.sh is now Upsun. Click here to learn more
Upsun Fixed User Documentation

Use hooks with dependencies

Try Upsun for 15 days
After that, enjoy the same game-changing Upsun features for less with the First Project Incentive!¹ A monthly $19 perk!
Activate your 15-day trial
¹Terms and conditions apply. Only for Flexible Resource projects.

If you use a specific package in a hook, you may want to manage dependencies for it. For example, you may want to compile Sass files as part of your build process. You can set dependencies along with hooks in your app configuration.

The following example assumes you have some Sass source files, such as a index.scss file. You also need a script to compile the files, such as the following:

package.json
{
  "scripts": {
    "build-css": "sass index.scss css/index.css"
  },
}

Set your app configuration to have Sass available globally and use it:

.platform.app.yaml
# Ensure sass is available globally
dependencies:
  nodejs:
    sass: "^1.47.0"

hooks:
  # Run the script defined in package.json
  build: |
    npm run build-css