-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathGruntfile.js
112 lines (107 loc) · 3.13 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
module.exports = function (grunt) {
grunt.initConfig({
jekyll: { // Task
options: { // Universal options
bundleExec: true,
// src : '<%= app %>'
},
dist: { // Target
options: { // Target options
dest: 'dist',
config: '_config.yml'
}
},
serve: { // Another target
options: {
serve: true,
dest: '.jekyll',
drafts: true,
future: true
}
}
},
sass: {
options: {
implementation: require('sass'),
importer: require('grunt-sass-tilde-importer')
},
dist: {
files: {
'assets/dist/css/style.min.css': 'assets/src/sass/style.scss'
}
}
},
browserify: {
dist: {
files: {
'assets/dist/js/main.min.js': 'assets/src/js/main.js'
},
options: {
transform: [['babelify', {
presets: ["@babel/preset-env"],
global: true,
ignore: [/\/node_modules\/(?!gsap\/)/]
}]],
browserifyOptions: {
debug: true
}
}
}
},
uglify: {
build: {
src: 'assets/dist/js/main.min.js',
dest: 'assets/dist/js/main.min.js'
}
},
watch: {
css: {
files: ['assets/src/sass/**/*.*'],
tasks: ['sass', 'postcss']
},
js: {
files: ['assets/src/js/**/*.*'],
tasks: ['browserify:dist', 'uglify']
},
jekyll: {
files: ['_includes', '_layouts', '_news', "_plugins", "_resources", "_site", "_software"],
tasks: ['jekyll:dist']
}
},
postcss: {
autoprefixer: {
options: {
// TODO: Get sourcemaps working
// True for inline sourcemaps
map: false,
processors: [
// Please see 'browserslist' key in package.json for the browsers that autoprefixer will target
require('autoprefixer')(),
]
},
src: 'assets/dist/css/*.css'
},
minifyCSS: {
options: {
processors: [
require('cssnano')(),
]
},
src: 'assets/dist/css/*.css'
}
}
});
// Load the plug-ins (Node Modules) that are needed by the various tasks.
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('@lodder/grunt-postcss'); // grunt-postcss no longer maintained, hence the @lodder version
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jekyll');
// Default task - runs when you type 'grunt' in the terminal.
grunt.registerTask('default', ['watch']);
// Dev task (leaves the compiled CSS and JS unminified for easier debugging, until sourcemaps are working)
grunt.registerTask('dev', ['sass', 'postcss:autoprefixer', 'browserify:dist', 'jekyll:dist']);
// Build task
grunt.registerTask('build', ['sass', 'postcss', 'browserify:dist', 'uglify', 'jekyll:dist']);
}