You've built your JavaScript application but how do you automate testing, code analysis, running it locally or deploying it? These redundant tasks can consume valuable time and resources. Stop working so hard and take advantage of JavaScript task automation using Gulp to streamline these tasks and give you back more time in the day. Studying this repo can help clarify how Gulp works, jump-start task automation with Gulp, find and resolve issues faster, and be a more productive.
- Install Node
- on OSX install home brew and type
brew install node - on Windows install chocolatey
- More tips on Windows with node
- open command prompt as administrator
- type
choco install nodejs - type
choco install nodejs.install
- type
- On OSX you can alleviate the need to run as sudo by following these instructions. I highly recommend this step on OSX
- on OSX install home brew and type
- Open terminal
- Type
npm install -g node-inspector bower gulp tsd
Clone this repo and run the content locally
$ npm install
$ bower install
$ tsd install -r -o --save
$ gulp serve-dev-
gulp helpDisplays all of the available gulp tasks.
-
gulp vetPerforms static code analysis on all javascript files. Runs jshint and jscs.
-
gulp vet --verboseDisplays all files affected and extended information about the code analysis.
-
gulp platoPerforms code analysis using plato on all javascript files. Plato generates a report in the reports folder.
-
gulp serve-specsServes and browses to the spec runner html page and runs the unit tests in it. Injects any changes on the fly and re runs the tests. Quick and easy view of tests as an alternative to terminal via
gulp test. -
gulp testRuns all unit tests using karma runner, mocha, chai and sinon with phantomjs. Depends on vet task, for code analysis.
-
gulp test --startServersRuns all unit tests and midway tests. Cranks up a second node process to run a server for the midway tests to hit a web api.
-
gulp autotestRuns a watch to run all unit tests.
-
gulp autotest --startServersRuns a watch to run all unit tests and midway tests. Cranks up a second node process to run a server for the midway tests to hit a web api.
-
gulp cleanRemove all files from the build and temp folders
-
gulp clean-imagesRemove all images from the build folder
-
gulp clean-codeRemove all javascript and html from the build folder
-
gulp clean-fontsRemove all fonts from the build folder
-
gulp clean-stylesRemove all styles from the build folder
-
gulp fontsCopy all fonts from source to the build folder
-
gulp imagesCopy all images from source to the build folder
-
gulp stylesCompile less files to CSS, add vendor prefixes, and copy to the build folder
-
gulp wiredepLooks up all bower components' main files and JavaScript source code, then adds them to the
index.html.The
.bowerrcfile also runs this as a postinstall task wheneverbower installis run.
-
gulp templatecacheCreate an Angular module that adds all HTML templates to Angular's $templateCache. This pre-fetches all HTML templates saving XHR calls for the HTML.
-
gulp templatecache --verboseDisplays all files affected by the task.
-
gulp serve-devServes the development code and launches it in a browser. The goal of building for development is to do it as fast as possible, to keep development moving efficiently. This task serves all code from the source folders and compiles less to css in a temp folder.
-
gulp serve-dev --nosyncServes the development code without launching the browser.
-
gulp serve-dev --debugLaunch debugger with node-inspector.
-
gulp serve-dev --debug-brkLaunch debugger and break on 1st line with node-inspector.
-
gulp serve-dev --stubsServes the development code with the stubs to avoid hitting a real backend
-
gulp optimizeOptimize all javascript and styles, move to a build folder, and inject them into the new index.html
-
gulp buildCopies all fonts, copies images and runs
gulp optimizeto build the production code to the build folder.
-
gulp serve-buildServe the optimized code from the build folder and launch it in a browser.
-
gulp serve-build --nosyncServe the optimized code from the build folder and manually launch the browser.
-
gulp serve-build --debugLaunch debugger with node-inspector.
-
gulp serve-build --debug-brkLaunch debugger and break on 1st line with node-inspector.