2019-08-09 13:17:25 +00:00
|
|
|
const sass = require('node-sass');
|
|
|
|
|
2016-12-12 22:43:20 +00:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
|
|
|
|
imagemin: {
|
2020-05-27 10:16:55 +00:00
|
|
|
// media: {
|
|
|
|
// files: [{
|
|
|
|
// expand: true,
|
|
|
|
// cwd: 'media/images/',
|
|
|
|
// src: '{,*/}*.{png,jpg,jpeg,gif}',
|
|
|
|
// dest: 'media/images'
|
|
|
|
// }]
|
|
|
|
// },
|
|
|
|
static: {
|
2016-12-12 22:43:20 +00:00
|
|
|
files: [{
|
|
|
|
expand: true,
|
2020-05-27 10:16:55 +00:00
|
|
|
cwd: 'publichealth/static/images',
|
2016-12-12 22:43:20 +00:00
|
|
|
src: '{,*/}*.{png,jpg,jpeg,gif}',
|
2020-05-27 10:16:55 +00:00
|
|
|
dest: 'publichealth/static/images'
|
2016-12-12 22:43:20 +00:00
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-01-18 11:13:36 +00:00
|
|
|
watch: {
|
|
|
|
sass: {
|
|
|
|
files: "publichealth/static/**/*.scss",
|
|
|
|
tasks: ['sass:dev']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
sass: { // Task
|
|
|
|
dev: { // Target
|
|
|
|
options: { // Target options
|
2019-08-09 13:17:25 +00:00
|
|
|
implementation: sass,
|
|
|
|
sourcemap: false
|
2017-01-18 11:13:36 +00:00
|
|
|
},
|
|
|
|
files: { // Dictionary of files
|
2017-05-03 06:51:43 +00:00
|
|
|
"./assets/css/main.css": "publichealth/static/css/main.scss"
|
2017-01-18 11:13:36 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
options: {
|
2019-08-09 13:17:25 +00:00
|
|
|
outputStyle: 'compressed',
|
|
|
|
implementation: sass,
|
|
|
|
sourcemap: true
|
2017-01-18 11:13:36 +00:00
|
|
|
},
|
|
|
|
files: {
|
2017-05-03 06:51:43 +00:00
|
|
|
"./assets/css/main.min.css": "publichealth/static/css/main.scss"
|
2017-01-18 11:13:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-12-12 22:43:20 +00:00
|
|
|
bgShell: {
|
|
|
|
_defaults: {
|
|
|
|
bg: true,
|
|
|
|
stdout: false,
|
|
|
|
stderr: false,
|
|
|
|
},
|
|
|
|
runDjango: {
|
|
|
|
cmd: 'python manage.py runserver'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
browserSync: {
|
|
|
|
dev: {
|
|
|
|
bsFiles: {
|
2017-01-18 11:13:36 +00:00
|
|
|
src: [
|
2017-05-03 06:51:43 +00:00
|
|
|
"./assets/css/*.css",
|
|
|
|
"./*.html"
|
2017-01-18 11:13:36 +00:00
|
|
|
]
|
2016-12-12 22:43:20 +00:00
|
|
|
},
|
|
|
|
options: {
|
2017-01-18 11:13:36 +00:00
|
|
|
watchTask: true,
|
2016-12-12 22:43:20 +00:00
|
|
|
proxy: "localhost:8000"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-imagemin');
|
2017-01-18 11:13:36 +00:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
2016-12-12 22:43:20 +00:00
|
|
|
grunt.loadNpmTasks('grunt-bg-shell');
|
|
|
|
grunt.loadNpmTasks('grunt-browser-sync');
|
2019-08-09 13:17:25 +00:00
|
|
|
grunt.loadNpmTasks('grunt-sass');
|
2017-01-18 11:13:36 +00:00
|
|
|
grunt.registerTask('default', ['imagemin', 'sass']);
|
2016-12-12 22:43:20 +00:00
|
|
|
grunt.registerTask('browser-sync', [
|
|
|
|
'bgShell',
|
2017-01-18 11:13:36 +00:00
|
|
|
'browserSync',
|
|
|
|
'watch'
|
2016-12-12 22:43:20 +00:00
|
|
|
]);
|
|
|
|
};
|