Gulp configuration for silverorange PHP websites.
yarn add --dev gulp sogulp
- add a
gulpfile.js
that contains:const tasks = require('sogulp'); module.exports = tasks;
git add package.json yarn.lock
git commit
gulp
Recompiles LESS files automatically when they are changed. To use, do the following:
- Make sure
compile=On
is set in the[resources]
section of site-name.ini. - Run
yarn install
to install all the packages needed for our Gulp configuration. - run
gulp
in a terminal
After gulp is running, any changes you make to a LESS file will cause the file to be recompiled. You can see any error messages in the output of the terminal where gulp is running.
The gulp configuration also provides source-maps for compiled LESS. This means in Firefox and Chrome you can get proper line number and file information in the CSS inspector tool.
The gulp log output will tell you if there is a PHP error when you save a PHP file.
If you want to work on a package, you can create symlinks to the package files
and www/
resources using --symlinks=packageName1,packageName2
.
Package symlinks are restored after gulp tasks are finished.
The gulp file also contains a task to run
concentrate for a site. After
performing the yarn install
step you can run gulp concentrate
and all the
compiled, combined files will be generated.