Skip to content

Instantly share code, notes, and snippets.

@bencooling
Last active December 19, 2015 19:38
Show Gist options
  • Save bencooling/6007227 to your computer and use it in GitHub Desktop.
Save bencooling/6007227 to your computer and use it in GitHub Desktop.
Node & NPM, Grunt.
(function () {
'use strict';
module.exports = function(grunt) {
// Plugins
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
run: ['Gruntfile.js', 'assets/main.js', 'assets/js/*.js']
},
sass: {
run: {
options: { style: 'compressed' }, // style: 'expanded'
files: { 'assets/style.css': 'assets/main.scss' }
}
},
clean: {
run: [ 'assets/script.min.js', 'assets/style.css' ]
},
watch: {
options: {
livereload: true,
},
js: {
files: ['assets/js/*.js', 'assets/main.js'],
tasks: ['jshint:run']
},
css: {
files: ['assets/style.css']
},
sass: {
options: { livereload: false },
files: ['assets/scss/*.scss', 'assets/main.scss'],
tasks: ['sass:run']
}
},
requirejs: {
run: {
options: {
baseUrl: 'assets',
name: "main",
out: "assets/script.min.js"
}
}
}
});
// 1. Delete compiled .css & .js
// 2. jshint, compile js (requirejs), compile css (sass)
// 3. watch (sass, jshint both with live reload)
grunt.registerTask('run',
['clean:run', 'sass:run', 'jshint:run', 'requirejs:run', 'watch']);
};
}());
# Node (osx)
# ----------
# node & npm
sudo brew install node
# Grunt
# -----
# See bencooling/skeleton-static for web project with Grunt boilerplate
# grunt-cli (Install locally)
npm install -g grunt-cli
# grunt package
npm install grunt-shell
# New project
cd [project-name] && npm init
# Exisiting project: Install grunt & dependencies (based on package.json)
cd [project-name] && npm install
# packages
# --------
# Add -g to install globally
# bower
npm install -g bower
# jshint
npm install jshint
# Coffee Script
sudo npm install -g coffee-script
# Docco
# -----
# pygments
sudo easy_install pygments
sudo npm install -g pygments
# docco
sudo npm install -g docco
# Run docco on directory with .js files
docco jquery.tooltip.js
{
"name": "bencooling.github.io",
"description": "Ben Cooling website",
"version": "0.1.0",
"author": "Ben Cooling",
"jekyll_src": "_src",
"jekyll_serve": "_site",
"jekyll_deploy": "_deploy",
"path_assets": "assets",
"path_bower": "assets/lib",
"repo_tmp": "/tmp/bencooling.github.io",
"repo_github": "bencooling/bencooling.github.io",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-bower-task": "0.3.2",
"grunt-contrib-requirejs": "~0.4.1",
"grunt-contrib-watch": "~0.4.4",
"grunt-jekyll": "~0.3.6",
"grunt-contrib-connect": "~0.3.0",
"grunt-contrib-sass": "~0.5.0",
"grunt-contrib-clean": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-compress": "~0.5.2",
"grunt-contrib-copy": "~0.4.1",
"grunt-shell": "~0.2.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment