-
Notifications
You must be signed in to change notification settings - Fork 1
/
gruntfile.js
104 lines (95 loc) · 5.21 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
module.exports = function(grunt) {
// Initialize config
grunt.initConfig({
// Load package.json
pkg: require('./package.json'),
// Project paths
project: {
assets: 'assets',
styles: '<%= project.assets %>/stylesheets',
styles_scss: '<%= project.styles %>/scss',
styles_critical: '<%= project.styles %>/critical',
scripts: '<%= project.assets %>/javascript',
scripts_main: '<%= project.scripts %>/main',
scripts_modules: '<%= project.scripts %>/modules',
scripts_plugins: '<%= project.scripts %>/lib/plugins',
scripts_polyfills: '<%= project.scripts %>/lib/polyfills',
scripts_utils: '<%= project.scripts %>/lib/utils',
},
// Project banner
tag: {
banner_basic: '/**\n' +
' * <%= pkg.description %> — v<%= pkg.version %> — <%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * <%= pkg.url %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.copyright %>\n' +
' * License <%= pkg.license %>\n' +
' */\n',
banner_extended: '/**\n' +
' * <%= pkg.description %>\n' +
' *\n' +
' * @authors <%= pkg.author %>\n' +
' * @link <%= pkg.url %>\n' +
' * @version <%= pkg.version %>\n' +
' * @generated <%= grunt.template.today("yyyy-mm-dd:hh:mm") %>\n' +
' * @copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.copyright %>\n' +
' * @license <%= pkg.license %>\n' +
' */\n'
},
// JS files and order
jsfiles: {
head: [
'<%= project.scripts_plugins %>/enhance/enhance.js',
// '<%= project.scripts_plugins %>/modernizr/modernizr.dev.js',
'<%= project.scripts_plugins %>/modernizr/modernizr.min.js', // ALWAYS use custom build modernizr in production!
'<%= project.scripts_main %>/head.scripts.js',
],
main: {
plugins: [
'<%= project.scripts_plugins %>/debounce/debounce.js', // Out-comment when using filters module!
'<%= project.scripts_plugins %>/domready/domready.js', // ALWAYS out-comment. It is used in the `main` and `mobile` scripts files!
'<%= project.scripts_plugins %>/fontfaceobserver/fontfaceobserver.js', // Out-comment when loading fonts
// '<%= project.scripts_plugins %>/gumshoe/gumshoe.js',
'<%= project.scripts_plugins %>/imageset/imageset.js', // Out-comment when using imageset's lazyload
'<%= project.scripts_plugins %>/imageset/ls.bgset.js', // Out-comment when using imageset's lazyload + background images with a width descriptor, similar to how `srcset` works (e.g. for Safari 10.x)
'<%= project.scripts_plugins %>/imageset/ls.parent-fit.js', // Out-comment when using imageset's lazyload + background images; when `bgset` plugin (background images) is used in combination with data-sizes="auto" and `background-size: cover|contain` (e.g. for Edge, IE11 and older, iOS 9, etc.)
// '<%= project.scripts_plugins %>/transitionend/transitionend.js', // Out-comment when using alerts or navmain module!
'<%= project.scripts_plugins %>/smooth-scroll/smooth-scroll.js',
// '<%= project.scripts_plugins %>/throttle/throttle.js',
],
polyfills: [
'<%= project.scripts_polyfills %>/classlist.js', // Adds cross-browser full `element.classList` support (e.g. IE11)
'<%= project.scripts_polyfills %>/closest.js', // Adds cross-browser `element.closest()` support (e.g. for smooth-scroll support in IE11)
'<%= project.scripts_polyfills %>/customevent.js', // Adds cross-browser `new CustomEvent()` support (e.g. for smooth-scroll support in IE11)
// '<%= project.scripts_polyfills %>/promise.js',
// '<%= project.scripts_polyfills %>/ls.respimg.js', // Only partial `respimage` polyfill (see: https://github.com/aFarkas/lazysizes/tree/gh-pages/plugins/respimg); out-comment when not conditionally loading `respimage.min.js` in `head.scripts.js`
'<%= project.scripts_polyfills %>/svg4everybody.js', // Adds external spritemaps support to otherwise svg-capable browsers (e.g. IE11)
],
utils: [
// '<%= project.scripts_utils %>/ajax.util.js',
// '<%= project.scripts_utils %>/cookie.util.js', // Out-comment when enhance (and thus enhance.cookie) is not used
// '<%= project.scripts_utils %>/domparents.util.js',
// '<%= project.scripts_utils %>/extend.util.js', // Out-comment when using alerts module!
'<%= project.scripts_utils %>/isvisible.util.js', // Out-comment when using filters module!
],
modules: [
// '<%= project.scripts_modules %>/alerts.module.js',
// '<%= project.scripts_modules %>/expand.module.js',
'<%= project.scripts_modules %>/filters.module.js',
'<%= project.scripts_modules %>/fontobserver.module.js',
// '<%= project.scripts_modules %>/navmain.module.js',
'<%= project.scripts_modules %>/overlay.module.js',
// '<%= project.scripts_modules %>/popup.module.js',
// '<%= project.scripts_modules %>/toggleview.module.js',
// Main
'<%= project.scripts_main %>/main.scripts.js',
],
},
},
});
// Load per-task config from separate files
grunt.loadTasks('grunt/config');
// Register alias tasks from separate files
grunt.loadTasks('grunt/tasks');
// Register default task
grunt.registerTask('default', ['develop']);
};