Skip to content

Instantly share code, notes, and snippets.

@flenter
Last active December 25, 2015 14:39
Show Gist options
  • Save flenter/6992234 to your computer and use it in GitHub Desktop.
Save flenter/6992234 to your computer and use it in GitHub Desktop.
wercker.yml for php with a yui compressor step
box: wercker/php
# Build definition
build:
# The steps that will be executed on build
steps:
# A custom script s tep, name value is used in the UI
# and the code value contains the command that get executed
- script:
name: echo php information
code: |
echo "php version $(php --version) running"
echo "from location $(which php)"
# Add more steps here:
#- script:
# name: run unit tests
# code: phpunit
after-steps:
- hipchat-notify:
token: $HIPCHAT_TOKEN
room-id: 199099
from-name: Wercker
deploy:
steps:
- script:
name: simple ls step
code: |
ls -la
after-steps:
- hipchat-notify:
token: $HIPCHAT_TOKEN
room-id: 199099
from-name: Wercker
@flenter
Copy link
Author

flenter commented Oct 16, 2013

For minifying we can do the following changing the build steps from

    # A custom script s tep, name value is used in the UI
    # and the code value contains the command that get executed
    - script:
        name: echo php information
        code: |
          echo "php version $(php --version) running"
          echo "from location $(which php)"
    # Add more steps here:
    #- script:
    #    name: run unit tests
    #    code: phpunit

to:

    - install-packages:
        packages: yui-compressor
    - script:
        name: move code to output dir
        code: |
          mkdir -p $WERCKER_OUTPUT_DIR/views
          cp -r * $WERCKER_OUTPUT_DIR/views
    - script:
        name: run yui compressor for js
        code: |
          cd $WERCKER_OUTPUT_DIR
          for file in `find . -name "*.js"`; do java -jar /usr/share/yui-compressor/yui-compressor.jar --type js -v -o $file $file; done
    - script:
        name: run yui compressor for css
        code: |
          cd $WERCKER_OUTPUT_DIR
          for file in `find . -name "*.css"`; do java -jar /usr/share/yui-compressor/yui-compressor.jar --type css -v -o $file $file; done

edit: Yui compressor doesn't like more than 1 layer of directories. compress step split into two steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment