forked from zafree/shapes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
99 lines (87 loc) · 2.19 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*!
* Shapes's Gruntfile
* http://zafree.github.io/shapes
* Copyright 2014-2015 Zafree
* Licensed under MIT (https://github.com/shapes/blob/master/LICENSE)
*/
module.exports = function(grunt) {
'use strict';
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/*!\n' +
' * Shapes v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
' * Copyright 2014-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
' */\n',
express: {
all: {
options: {
bases: ['.'],
port: 9090,
hostname: "localhost",
livereload: true
}
}
},
open: {
all: {
path: 'http://localhost:9090/'
}
},
cssmin: {
options: {
banner: '<%= banner %>\n',
},
dist: {
src: ['dist/css/<%= pkg.name %>.css'],
dest: 'dist/css/<%= pkg.name %>.min.css'
}
},
less: {
options: {
banner: '<%= banner %>\n',
},
development: {
options: {
paths: ["dist/css"]
},
files: {
"dist/css/<%= pkg.name %>.css": "less/<%= pkg.name %>.less"
}
},
build: {
src: ['less/<%= pkg.name %>.less'],
dest: 'dist/css/<%= pkg.name %>.css'
}
},
watch: {
less: {
files: 'less/*.less',
tasks: ['less']
},
cssmin: {
files: 'less/*.less',
tasks: ['cssmin']
},
all: {
files: '**/*.html',
options: {
livereload: true
}
}
}
});
// Load the plugin that provides the task.
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-express');
// Default task(s).
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['less','cssmin']);
// Creates the `server` task
grunt.registerTask('serve', ['express','open','watch']);
};