- Download and unzip to your WAMP's
www
directory placing all code within agulp-starter
directory- Or change
localProjectBaseDir
inconfig.json
to whatever directory name you have chosen to use - Other path variables exist in
config.json
but take care when modifying these
- Or change
- If instead you choose to clone this repo using the GitHub client, copy the contents of this repo to your WAMP's
www
directory (placing all code within agulp-starter
directory)- This way your cloned copy can remain clean
- Should you choose to use this repo for other projects simply repeat the process of copying the cloned repo to a new location
- This way your cloned copy can remain clean
- Drop all code that requires pre-processing (so fonts, images, JavaScript and CSS) into the
/app
directory adhering to the following structure- Everything else can go into
/public_html
- So
*.html
,*.php
, etc.
- So
- Everything else can go into
/gulp-starter
/app
/fonts
/images
/scripts
/styles
/bower_components
/public_html
*.html
*.php
/secure
private
- All script tags linking to a local source should be removed - from your footer where they should be - and replaced with one, single call
/public_html/scripts/all.min.js
is all JavaScript stored in/app/scripts
concatenated into one file
<script src="scripts/all.min.js"></script>
- Assuming you have configured your remote web server for SSH access
- Add your private SSH key file to
/secure
and name the fileprivate
(without any extension)- Remember it must be in the OpenSSH format
- puttygen can export into this format
- Remember it must be in the OpenSSH format
- Add your private SSH key file to
- Change
webAccount
inconfig.json
to that of your remotedevelopment
web account- e.g.
wdu999
- e.g.
- Amend
.ftppass
to contain the passphrase linked to your SSH details and the user/web account you want to SFTP into- The web account set for
development
should be the same as that set forwebAccount
inconfig.json
(as ^above^) - Define the details of your
production
environment in the same way you have done fordevelopment
- For info, by default uploads are transferred to
public_html
on the remote web server no matter what environment is used
- The web account set for
- Change
symbolicLink
inconfig.json
to that set for yourproduction
environment- e.g.
medi-cal
(which corresponds to http://www.abdn.ac.uk/medi-cal/)
- e.g.
- Install Node.js - http://nodejs.org/download/ (Windows Installer)
- To check your installation is configured properly, open a terminal and type in
node --version
- This should return a version number at or above
0.12.x
- This should return a version number at or above
- Install Composer - https://getcomposer.org/Composer-Setup.exe
- You may need to enable OpenSSL in your PHP installation by going directly to
./wamp/bin/php/php-5.4.x/php.ini
and enabling the OpenSSL extension
- You may need to enable OpenSSL in your PHP installation by going directly to
- Double-click
global-installs-composer.cmd
to run the installation- The prompt window will close itself when setup has finished successfully
- Add
%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
to thePATH
System Variable- Start → Run →
control sysdm.cpl,,3
- Start → Run →
- To check your installation is configured properly, open a terminal and type in
composer --version
- This should return a long hash similar to
a309e1d89ded6919935a842faeaed8e888fbfe37
- This should return a long hash similar to
- Copy the directory
./gulp-starter/composer_plugins/vendor/squizlabs/
and paste at%USERPROFILE%\AppData\Roaming\Composer\vendor\
- Click 'Yes' when the 'Confirm Folder Replace' dialog appears
- Click 'Copy and Replace' when the 'Copy File' dialog appears
$ npm install --global gulp
- Ensure
config.json
hasskipLocalInstall
set tofalse
$ npm update --save-dev
$ gulp
- Ensure
config.json
hasskipLocalInstall
set totrue
- Ensure
./node_modules
is deleted or empty
$ global-installs-npm.cmd
- Start → Run →
%USERPROFILE%\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
- @ Line ~84
if (!env.modulePath) {
env.modulePath = process.env.USERPROFILE + '/AppData/Roaming/npm/node_modules/gulp/';
env.modulePackage.version = cliPackage.version;
/*
gutil.log(
chalk.red('Local gulp not found in'),
chalk.magenta(tildify(env.cwd))
);
gutil.log(chalk.red('Try running: npm install gulp'));
process.exit(1);
*/
}
- Terminal →
nano /usr/local/lib/node_modules/gulp/bin/gulp.js
- @ Line ~84
if (!env.modulePath) {
env.modulePath = '/usr/local/lib/node_modules/gulp/';
env.modulePackage.version = cliPackage.version;
/*
gutil.log(
chalk.red('Local gulp not found in'),
chalk.magenta(tildify(env.cwd))
);
gutil.log(chalk.red('Try running: npm install gulp'));
process.exit(1);
*/
}
$ gulp
Working locally
$ gulp
- Open the terminal within your project directory - leave this prompt open after execution
- This task will build everything and push it to
/public_html
gulp
will open up Chrome to this page - keep this page open
- Begin coding as you normally would and any changes to your code will be mimicked in your browser without having to reload the page
Working remotely in your development
environment
$ gulp app:upload:dist
- Open the terminal within your project directory - leave this prompt open after execution
- This command uses the
development
environmental details specified in.ftppass
- To form a URL it combines
remoteBaseDevUrl
('homepages') withwebAccount
as set inconfig.json
- This command uses the
- This will build everything and push the code in
/public_html
to your development web server following the same directory structuregulp
will open up Chrome to this page - keep this page open
- Begin coding as you normally would pressing
Ctrl + F5
to view your file changes
Working remotely in your production
environment
$ gulp app:upload:dist --production
- Open the terminal within your project directory - leave this prompt open after execution
- This command uses the
production
environmental details specified in.ftppass
- To form a URL it changes to use
remoteBaseProdUrl
('www') combined withsymbolicLink
as set inconfig.json
- It also fully minifies and obfuscates JavaScript and removes all console logging whilst preserving license comment blocks
- This command uses the
- This will build everything and push the code in
/public_html
to your production web server following the same directory structuregulp
will open up Chrome to this page - keep this page open
- Begin coding as you normally would pressing
Ctrl + F5
to view your file changes
$ gulp app:build:documentation
$ gulp app:build:styles:src:critical
$ gulp app:generate:dist:pagespeed
$ gulp app:generate:dist:screenshots
$ gulp app:generate:src:stats
$ gulp app:lint:dist:htmlhint
$ gulp app:lint:dist:phpcpd
$ gulp app:lint:dist:phpcs
$ gulp app:lint:dist:phpcbf
$ gulp app:lint:dist:phpmd
$ gulp app:lint:src:csslint
$ gulp app:lint:src:jscs
$ gulp app:lint:src:jshint
$ gulp app:process:path --folder public_html
$ gulp bower:install
- You can also create separate task files within the
/tasks
directory (e.g./tasks/example.js
) which will be read in automatically and available to run on the command line - Note for bower users: if your package doesn't appear in the
dist
directory then the main property for that packagesbower.json
hasn't been set.- You will therefore need to create an override in your
bower.json
file to specify the main files of that package. - See https://github.com/ck86/main-bower-files#overrides-options for more
- You will therefore need to create an override in your
.htmlhintrc
- Contains rules (in JSON format) for checking HTML files
- Open a terminal within your project directory and type in
gulp htmlhint
to run the associated task
.jscsrc
- Contains rules (in JSON format) for checking JavaScript files
- You will need to amend the
jscs
task ingulpfile.js
to run against a JavaScript file of your choosing that resides within/app/scripts
- Open a terminal within your project directory and type in
gulp jscs
to run the associated task
- If you're doing any cross-browser testing with BrowserStack's local setup, you can edit when running
$ gulp
and live-reload directly inside of a BrowserStack VM.- Use
3000
as the port number and untick HTTPS
- Use
$ npm install --global gulp-devtools
- Download the Gulp Devtools extension for Chrome Developer Tools from the Chrome Web Store
- Open a terminal within your project directory and type in
gulp-devtools
- Open Chrome Developer tools and find the Gulp tab
- Your
gulp
tasks should now be accessible to run within Chrome
- Your
A custom build target should have a separate config_custom_target.json
file.
Usage example:
$ gulp --load-config custom_target
Makes Gulp use the values from config_custom_target.json
in order to create a custom build target.