Install required NPM modules in the directory
npm install gulp jshint gulp-jshint jshint-stylish gulp-watchCreate your gulpfile.js and paste in the following code
var gulp = require('gulp');| // Performs an action, but caluculates/returns no value | |
| // console.log(returnNothing()); | |
| var returnNothing = function() { | |
| console.log("I don't return anything"); | |
| }; | |
| // returnNothing(); | |
| // Does a task and returns the result of that task | |
| var result = addStuff(); |
| module.exports = function(grunt) { | |
| grunt.initConfig({ | |
| // Change the b-fy task to add a transform task | |
| browserify: { | |
| js: { | |
| src: ['./js/main.js'], | |
| dest: 'dist/app.js' | |
| }, | |
| options: { |
| { | |
| "name": "hbs_browserify-grunt", | |
| "version": "0.1.0", | |
| "devDependencies": { | |
| "browserify": "^13.0.0", | |
| "grunt": "^0.4.5", | |
| "grunt-browserify": "^5.0.0", | |
| "grunt-contrib-handlebars": "^1.0.0", | |
| "grunt-contrib-jshint": "^0.11.2", | |
| "grunt-contrib-nodeunit": "~0.4.1", |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <title></title> | |
| <link rel="stylesheet" href=""> | |
| </head> | |
| <body> | |
| <h3>A list of things</h3> |
| console.log(Sandwich); | |
| var sandwichCost = Sandwich.getSandwichPrice("cheese"); | |
| var toppingCost = Sandwich.getToppingPrice("captainCrunch"); | |
| var output = document.getElementById("sandwich"); | |
| output.innerHTML = sandwichCost + toppingCost; |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <title></title> | |
| <link rel="stylesheet" href=""> | |
| </head> | |
| <body> | |
| <h3>A list of things</h3> |
Install required NPM modules in the directory
npm install gulp jshint gulp-jshint jshint-stylish gulp-watchCreate your gulpfile.js and paste in the following code
var gulp = require('gulp');| All the values in these objects happen to be strings ("Carly Rae Jepsen", "Livin on a Prayer", etc), but values can be any data type: | |
| String, array, boolean, null, undefined, even other objects. |
| //****************************************************************************************************************** | |
| // This will break if you run it as is. You have to commment out all of the sections except the one you want to run. | |
| //****************************************************************************************************************** | |
| /* | |
| Example one: call site and call stack | |
| */ |
| <!DOCTYPE html> <!-- tells browser what version--> | |
| <html> | |
| <head> <!-- header info, styles, meta etc--> | |
| <meta charset="UTF-8"> <!-- define alphabet--> | |
| <meta name="author" content="Joe Shepherd"> <!-- Define Page author --> | |
| <title>Hi there</title> <!--tab title--> | |
| <link rel="stylesheet" type="text/css" href="styles.css"> | |
| </head> | |
| <body><!-- displays the page--> | |
| <nav> |