forked from foundation/foundation-sites
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
220 lines (206 loc) · 6.76 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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
module.exports = function(grunt) {
var hljs = require('highlight.js');
hljs.LANGUAGES['scss'] = require('./lib/scss.js')(hljs);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
foundation: {
js: ['js/foundation/foundation.js', 'js/foundation/foundation.*.js'],
scss: ['scss/foundation.scss']
},
jst: {
compile: {
files: {
'dist/docs/assets/js/templates.js': ['doc/templates/*.html']
}
}
},
assemble: {
options: {
marked: {
gfm: true,
sanitize: false,
highlight: function(code, lang) {
if (lang === undefined) lang = 'bash';
if (lang === 'html') lang = 'xml';
if (lang === 'js') lang = 'javascript';
return '<div class="code-container">' + hljs.highlight(lang, code).value + '</div>';
}
}
},
dist: {
options: {
flatten: false,
assets: 'dist/docs/assets',
data: ['doc/data/*.json'],
partials: ['doc/includes/**/*.{html,scss}'],
helpers: ['doc/helpers/*.js'],
layout: 'doc/layouts/default.html'
},
expand: true,
cwd: 'doc/pages',
src: '**/*.{html,md}',
dest: 'dist/docs/'
}
},
sass: {
dist: {
options: {
includePaths: ['scss']
},
files: {
'dist/assets/css/foundation.css': '<%= foundation.scss %>',
'dist/assets/css/normalize.css': 'scss/normalize.scss',
'dist/docs/assets/css/docs.css': 'doc/assets/scss/docs.scss'
}
},
dist_compressed: {
options: {
outputStyle:'compressed',
includePaths: ['scss']
},
files: {
'dist/assets/css/foundation.min.css': '<%= foundation.scss %>'
}
}
},
concat: {
dist: {
files: {
'dist/assets/js/foundation.js': '<%= foundation.js %>',
'dist/docs/assets/js/all.js': ['bower_components/lodash/dist/lodash.min.js', 'bower_components/fastclick/lib/fastclick.js', 'bower_components/jquery.autocomplete/dist/jquery.autocomplete.js', 'bower_components/jquery-placeholder/jquery.placeholder.js', '<%= foundation.js %>', 'doc/assets/js/docs.js']
}
}
},
uglify: {
options: {
preserveComments: 'some'
},
dist: {
files: {
'dist/assets/js/foundation.min.js': ['<%= foundation.js %>'],
'dist/docs/assets/js/modernizr.js': ['bower_components/modernizr/modernizr.js']
}
},
vendor: {
files: {
'dist/assets/js/vendor/placeholder.js': 'bower_components/jquery-placeholder/jquery.placeholder.js',
'dist/assets/js/vendor/fastclick.js': 'bower_components/fastclick/lib/fastclick.js',
'dist/assets/js/vendor/jquery.cookie.js': 'bower_components/jquery.cookie/jquery.cookie.js',
'dist/assets/js/vendor/jquery.js': 'bower_components/jquery/dist/jquery.js',
'dist/assets/js/vendor/modernizr.js': 'bower_components/modernizr/modernizr.js'
}
}
},
copy: {
dist: {
files: [
{expand:true, cwd: 'doc/assets/', src: ['**/*','!{scss,js}/**/*'], dest: 'dist/docs/assets/', filter:'isFile'},
{expand:true, cwd: 'js/', src: ['foundation/*.js'], dest: 'dist/assets/js', filter: 'isFile'},
{src: 'bower_components/jquery/dist/jquery.min.js', dest: 'dist/docs/assets/js/jquery.js'},
{expand:true, cwd: 'scss/', src: '**/*.scss', dest: 'dist/assets/scss/', filter: 'isFile'},
{src: ['bower.json','sache.json','humans.txt','robots.txt'], dest: 'dist/assets/'}
]
}
},
clean: ['dist/'],
karma: {
options: {
configFile: 'karma.conf.js',
runnerPort: 9999,
},
continuous: {
singleRun: true,
browsers: ['SmallPhantomJS', 'LargePhantomJS']
},
dev: {
singleRun: true,
browsers: ['SmallPhantomJS', 'LargePhantomJS', 'SmallChrome', 'Firefox'],
reporters: 'dots'
},
dev_watch: {
background: true,
browsers: ['SmallPhantomJS', 'LargePhantomJS', 'SmallChrome', 'Firefox'],
},
mac: {
singleRun: true,
browsers: ['SmallPhantomJS', 'LargePhantomJS', 'SmallChrome', 'Firefox', 'Safari'],
reporters: 'dots'
},
win: {
singleRun: true,
browsers: ['SmallPhantomJS', 'LargePhantomJS', 'SmallChrome', 'Firefox', 'IE'],
reporters: 'dots'
}
},
watch: {
grunt: { files: ['Gruntfile.js'] },
karma: {
files: [
'dist/assets/js/*.js',
'spec/**/*.js',
'dist/assets/css/*.css'
],
tasks: ['karma:dev_watch:run']
},
sass: {
files: ['scss/**/*.scss', 'doc/assets/**/*.scss'],
tasks: ['sass'],
options: {livereload:false}
},
js: {
files: ['js/**/*.js', 'doc/assets/js/**/*.js'],
tasks: ['copy', 'concat', 'uglify'],
options: {livereload:false}
},
jst: {
files: ['doc/templates/*.html'],
tasks: ['jst'],
options: {livereload:false}
},
assemble_all: {
files: ['doc/{includes,layouts}/**/*.html'],
tasks: ['assemble'],
options: {livereload:false}
},
assemble_pages: {
files: ['doc/pages/**/*.html'],
tasks: ['newer:assemble'],
options: {livereload:false}
},
assets: {
options: {cwd: 'doc/assets/', livereload: false},
files: ['**/*','!{scss,js}/**/*'],
tasks: ['copy']
}
},
rsync: {
dist: {
options: {
args: ["--verbose"],
src: "./dist/docs/",
recursive: true,
dest: "/home/deployer/sites/foundation-docs/current",
host: "[email protected]"
}
}
}
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jst');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-rsync');
grunt.loadNpmTasks('assemble');
grunt.loadNpmTasks('grunt-newer');
grunt.task.registerTask('watch_start', ['karma:dev_watch:start', 'watch']);
grunt.registerTask('build:assets', ['clean', 'sass', 'concat', 'uglify', 'copy', 'jst']);
grunt.registerTask('build', ['build:assets', 'assemble']);
grunt.registerTask('travis', ['build', 'karma:continuous']);
grunt.registerTask('develop', ['travis', 'watch_start']);
grunt.registerTask('deploy', ['build', 'rsync:dist']);
grunt.registerTask('default', ['build', 'watch']);
};