This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
grunt.js
139 lines (132 loc) · 3.95 KB
/
grunt.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// the staging directory used during the process
staging: 'staging',
// final build output
output: 'output',
exclude: '',
mkdirs: {
staging: '<config:exclude>'
},
/*
less: {
all: {
src: '*.less',
dest: 'css/style.css',
options: {
compress: true
}
}
},
*/
// concat css/**/*.css files, inline @import, output a single minified css
// Otto: but minify does not seem to work?
css: {
'css/compressed.css': ['css/style.css', 'js/libs/facetview.css', 'js/libs/jquery-ui-1.8.18.custom/*.css', 'css/selectize.bootstrap3.css', 'css/selectize.default.css', 'css/magnific-popup.css' ]
// no openlayers included
},
// Renames JS/CSS to prepend a hash of their contents for easier
// versioning
rev: {
js: 'js/compressed.js',
css: 'css/compressed.css',
img: 'img/none'
},
// update references in html to revved files
usemin: {
html: ['views/*.mustache'],
// css: ['**/*.css'] // not needed in this project, images very rarely change
},
// html minification - too dangerous for mustache templates?
// html: '<config:usemin>',
// Optimizes JPGs and PNGs (with jpegtran & optipng)
img: {
dist: '<config:rev.img>'
},
watch: {
files: ['js/**', 'css/**', 'views/**'],
tasks: 'default',
reload: {
files: '<config:watch.files>',
tasks: 'default'
}
},
pkg: '<json:package.json>',
meta: {
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
lint: {
files: ['grunt.js', 'js/**/*.js', 'test/**/*.js']
},
qunit: {
files: ['test/**/*.html']
},
concat: {
dist: {
src: [
'js/libs/bootstrap/bootstrap.min.js',
'js/libs/bootstrap/transition.js',
'js/libs/bootstrap/collapse.js',
'js/libs/bootstrap/button.js',
// 'js/libs/jquery-ui-1.8.18.custom/jquery-ui-1.8.18.custom.min.js',
'js/libs/mustache/mustache.js',
'js/libs/selectize.js',
'js/libs/spin.js/spin.js',
// 'js/libs/linkify/1.0/jquery.linkify-1.0-min.js',
// 'js/libs/d3/d3.min.js',
// 'js/libs/d3/d3.geom.min.js',
// 'js/libs/d3/d3.layout.min.js',
'js/libs/json2.js',
'js/libs/jquery.facetview.js',
// 'js/libs/openlayers/openlayers.js',
'js/libs/gettext.js',
'js/libs/jquery.magnific-popup.js',
'js/plugins.js',
'js/script.js'
],
dest: 'js/temp.js',
separator: ';'
}
},
min: {
dist: {
src: 'js/temp.js',
dest: 'js/compressed.js'
}
},
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
}
},
uglify: {}
});
// does not work even when installed?
// grunt.loadNpmTasks('grunt-less');
// grunt.registerTask('default', 'intro clean mkdirs concat less css min img rev usemin manifest copy time');
grunt.registerTask('default', 'intro clean mkdirs concat min css img rev usemin manifest copy time');
grunt.registerTask('reload', 'default watch:reload');
// if "h5bp reload" fails with message "Error: watch EMFILE"
// it means the number of open files has exceeded
// lift limit by runnig as root
// $ echo 8704 > /proc/sys/fs/inotify/max_user_instances
};