project_root
|-- build
|-- src
| |-- coffee
| |-- img
| |-- jade
| |-- less
| `-- vendor
| |-- css
| `-- js
|-- Gruntfile.js
`-- package.json
Created
December 18, 2012 09:07
-
-
Save sapphiriq/4326419 to your computer and use it in GitHub Desktop.
Project template for grunt for compile Jade, Less, Coffee as static files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#global module:false | |
module.exports = (grunt) -> | |
# Project configuration. | |
grunt.initConfig | |
meta: | |
version: '0.1.0', | |
banner: '/*!\n * Sapphiriq - v<%= meta.version %> - ' + | |
'<%= grunt.template.today("yyyy-mm-dd") %>\n' + | |
' * http://sapphiriq.ru/\n' + | |
' * Copyright (c) <%= grunt.template.today("yyyy") %>\n */\n' | |
clean: | |
build: ['build'] | |
release: ['release'] | |
copy: | |
build: | |
files: | |
'build/img/': 'src/img/**' | |
'build/js/': 'src/vendor/js/**' | |
# 'build/css/': 'src/vendor/css/**' | |
release: | |
files: | |
'release/': 'build/**' | |
jade: | |
build: | |
options: | |
pretty: true | |
files: grunt.file.expandMapping(["src/jade/*.jade"], "build", | |
rename: (destBase, destPath) -> | |
destBase + destPath.replace(/src\/jade/, '').replace(/\.jade$/, ".html") | |
) | |
coffee: | |
build: | |
files: grunt.file.expandMapping(["src/coffee/**/*.coffee"], "build/js/", | |
rename: (destBase, destPath) -> | |
destBase + destPath.replace(/src\/coffee/, '').replace(/\.coffee$/, ".js") | |
) | |
less: | |
build: | |
options: | |
compress: false | |
files: | |
"build/css/style.css": "src/less/style.less" | |
release: | |
options: | |
compress: true | |
files: | |
"release/css/style.css": "src/less/style.less" | |
# lint: { | |
# files: ['grunt.js', 'src/**/*.js', 'test/**/*.js'] | |
# }, | |
# qunit: { | |
# files: ['test/**/*.html'] | |
# }, | |
watch: | |
coffee: | |
files: ['src/coffee/**/*.coffee'] | |
tasks: ['coffee:build'] | |
less: | |
files: ['src/less/**/*.less'] | |
tasks: 'less:build' | |
jade: | |
files: ['src/jade/**/*.jade'] | |
tasks: 'jade:build' | |
js: | |
files: ['src/vendor/js/**/*.js'] | |
tasks: 'copy:build' | |
css: | |
files: ['src/vendor/css/**/*.css'] | |
tasks: 'copy:build' | |
img: | |
files: ['src/img/**/*'] | |
tasks: 'copy:build' | |
# jshint: { | |
# options: { | |
# curly: true, | |
# eqeqeq: true, | |
# immed: true, | |
# latedef: true, | |
# newcap: true, | |
# noarg: true, | |
# sub: true, | |
# undef: true, | |
# boss: true, | |
# eqnull: true, | |
# browser: true | |
# }, | |
# globals: { | |
# jQuery: true | |
# } | |
# }, | |
concat: | |
dist: | |
options: | |
banner: '<%= meta.banner %>' | |
src: 'release/js/app.js' | |
dest: 'release/js/app.js' | |
uglify: | |
app: | |
options: | |
banner: '<%= meta.banner %>' | |
files: | |
'release/js/app.js': ['<%= concat.dist.dest %>'] | |
grunt.loadNpmTasks 'grunt-contrib-jade' | |
grunt.loadNpmTasks 'grunt-contrib-less' | |
grunt.loadNpmTasks 'grunt-contrib-coffee' | |
grunt.loadNpmTasks 'grunt-contrib-watch' | |
grunt.loadNpmTasks 'grunt-contrib-concat' | |
grunt.loadNpmTasks 'grunt-contrib-uglify' | |
grunt.loadNpmTasks 'grunt-contrib-copy' | |
grunt.loadNpmTasks 'grunt-contrib-clean' | |
# Default task. | |
grunt.registerTask 'default', ['copy:build', 'jade', 'coffee', 'less:build'] | |
grunt.registerTask 'build', 'default' | |
grunt.registerTask 'release', ['build', 'copy:release', 'less:release', 'concat', 'uglify'] | |
connect = require 'connect' | |
grunt.registerTask "server", "Start a custom static web server.", -> | |
grunt.log.writeln "Starting static web server in \"build\" on port 8080." | |
connect(connect.static("build")).listen 8080 | |
grunt.task.run('default') | |
grunt.task.run('watch') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Sapphiriq", | |
"version": "0.0.0", | |
"description": "# Sapphiriq", | |
"main": "Gruntfile.coffee", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": "", | |
"author": "", | |
"license": "BSD", | |
"devDependencies": { | |
"grunt": "~0.4.0", | |
"grunt-contrib-jshint": "~0.1.0", | |
"grunt-contrib-nodeunit": "~0.1.0", | |
"grunt-contrib-less": "~0.3.2", | |
"grunt-contrib-coffee": "~0.3.2", | |
"grunt-contrib-jade": "~0.3.1", | |
"grunt-contrib-uglify": "~0.1.0", | |
"grunt-contrib-watch": "~0.2.0", | |
"grunt-contrib-concat": "~0.1.1", | |
"grunt-contrib-copy": "~0.3.2", | |
"grunt-contrib-clean": "~0.4.0a", | |
"connect": "~2.7.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment