Skip to content

Instantly share code, notes, and snippets.

@hideki-a
Last active December 14, 2015 15:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hideki-a/5106226 to your computer and use it in GitHub Desktop.
Save hideki-a/5106226 to your computer and use it in GitHub Desktop.
Original gruntfile for generator-website.
'use strict'
PROJECT_DIR = ''
LIVERELOAD_PORT = 35729
lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT })
proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest
mountFolder = (connect, dir) ->
return connect.static(require('path').resolve(dir))
module.exports = (grunt) ->
grunt.initConfig
compass:
dev:
reference:
'htdocs/common/css': 'htdocs/_scss'
'htdocs/category/css': 'htdocs/category/_scss'
options:
config: 'config.rb'
environment: 'development'
dist:
reference: '<%= compass.dev.reference %>'
options:
config: 'config.rb'
environment: 'production'
force: true
connect:
livereload:
options:
hostname: '0.0.0.0'
port: 3501
middleware: (connect, options) ->
return [
lrSnippet
proxySnippet
mountFolder(connect, './htdocs')
]
proxies: [
context: '/contact'
host: PROJECT_DIR + '.localhost'
changeOrigin: true
]
watch:
options:
nospawn: true
livereload: true
compass:
files: 'htdocs/**/*.scss'
tasks: ['compass:dev']
static:
files: [
'htdocs/**/*.html'
'htdocs/**/*.js'
]
imageoptim:
files: ['htdocs']
options:
jpegMini: false
imageAlpha: false,
quitAfter: true
jshint:
options:
jshintrc: '.jshintrc'
all: [
'path/to/script.js'
]
uglify:
options:
preserveComments: 'some'
dist:
files:
'path/to/dest.js': ['path/to/src.js']
concat:
compo:
src: ['htdocs/common/js/components/*.js']
dest: 'htdocs/common/js/components.js'
csslint:
dist:
src: [
'htdocs/**/*.css'
'!htdocs/common/css/extras/*.css'
]
options:
csslintrc: '.csslintrc'
csscomb:
files:
src: [
'htdocs/**/*.css'
'!htdocs/common/css/extras/*.css'
]
cmq:
dist:
files:
'htdocs/path/to/css/' : ['htdocs/path/to/*.css'] # Overwriting
cssmin:
dist:
files: [
expand: true
src: ['htdocs/**/*.css']
]
open:
dev:
path: 'http://localhost:<%= connect.livereload.options.port %>'
xmlsitemap:
files: ['htdocs/**/*.html']
dest: 'test/sitemap.xml'
options:
exclude: ['/_scss', '/tmpl']
host: 'http://foo.localhost'
base: 'htdocs'
exec:
validator:
cmd: 'site_validator test/sitemap.xml test/validator/report.html'
growl:
notify: true
mkdir:
prepare:
options:
create: [
'htdocs/common/css'
'htdocs/common/images'
'archive'
'materials'
'test'
'test/validator'
]
copy:
prepare:
files: [
{
expand: true
cwd: '_scss_tmpl/'
src: ['*']
dest: 'htdocs/_scss/'
}
]
bower:
files: [
{
expand: true
flatten: true
cwd: 'jslib/'
src: ['**/*min*.js']
dest: 'htdocs/common/js/'
}
]
clean:
prepare: [
'htdocs/_scss/sample.scss'
'htdocs/_scss/makedoc.bash'
'htdocs/_scss/.git'
'_scss_tmpl'
'.git'
]
# Load grunt tasks.
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks)
# Register tasks.
grunt.registerTask 'default', [
'compass:dev'
'configureProxies'
'connect'
'open'
'watch'
]
grunt.registerTask 'publish', [
# 'jshint'
# 'concat'
# 'uglify'
'csslint'
'csscomb'
'cmq'
'cssmin'
'imageoptim'
]
grunt.registerTask 'prepare', [
'mkdir:prepare'
'copy:prepare'
'clean:prepare'
]
return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment