sol2/Gruntfile.js

135 lines
3.6 KiB
JavaScript
Raw Normal View History

module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
2013-11-04 05:59:15 +08:00
open : {
dev: {
path: 'http://localhost:1919'
}
},
2013-11-04 05:37:56 +08:00
connect: {
server: {
options: {
2013-11-04 05:59:15 +08:00
port: 1919,
base: 'demo_docs/build',
livereload: true
2013-11-04 05:37:56 +08:00
}
}
},
2014-02-01 00:58:37 +08:00
copy: {
fonts: {
files: [
// includes files within path
{expand: true, flatten: true, src: ['bower_components/font-awesome/fonts/*'], dest: 'sphinx_rtd_theme/static/fonts/', filter: 'isFile'}
]
}
},
2013-11-04 05:37:56 +08:00
sass: {
dev: {
options: {
style: 'expanded',
loadPath: ['bower_components/bourbon/dist', 'bower_components/neat/app/assets/stylesheets', 'bower_components/font-awesome/scss', 'bower_components/wyrm/sass']
},
files: [{
expand: true,
cwd: 'sass',
src: ['*.sass'],
dest: 'sphinx_rtd_theme/static/css',
ext: '.css'
}]
2013-11-04 05:37:56 +08:00
},
build: {
2013-11-04 05:37:56 +08:00
options: {
style: 'compressed',
2014-08-22 10:46:30 +08:00
loadPath: ['bower_components/bourbon/dist', 'bower_components/neat/app/assets/stylesheets', 'bower_components/font-awesome/scss', 'bower_components/wyrm/sass']
},
files: [{
expand: true,
cwd: 'sass',
src: ['*.sass'],
dest: 'sphinx_rtd_theme/static/css',
ext: '.css'
}]
}
},
2013-11-04 05:37:56 +08:00
2015-09-09 15:17:10 +08:00
browserify: {
dev: {
options: {
external: ['jquery'],
alias: {
'sphinx-rtd-theme': './js/theme.js'
}
},
src: ['js/*.js'],
dest: 'sphinx_rtd_theme/static/js/theme.js'
},
build: {
options: {
external: ['jquery'],
alias: {
'sphinx-rtd-theme': './js/theme.js'
}
},
src: ['js/*.js'],
dest: 'sphinx_rtd_theme/static/js/theme.js'
}
},
exec: {
2013-11-04 05:37:56 +08:00
bower_update: {
cmd: 'bower update'
2013-11-04 05:37:56 +08:00
},
build_sphinx: {
cmd: 'sphinx-build demo_docs/source demo_docs/build'
}
2013-11-04 05:37:56 +08:00
},
clean: {
2014-02-01 00:58:37 +08:00
build: ["demo_docs/build"],
fonts: ["sphinx_rtd_theme/static/fonts"]
2013-11-04 05:37:56 +08:00
},
watch: {
/* Compile sass changes into theme directory */
2013-11-04 05:37:56 +08:00
sass: {
files: ['sass/*.sass', 'bower_components/**/*.sass'],
tasks: ['sass:dev']
2013-11-04 05:37:56 +08:00
},
/* Changes in theme dir rebuild sphinx */
sphinx: {
files: ['sphinx_rtd_theme/**/*', 'demo_docs/**/*.rst', 'demo_docs/**/*.py'],
2013-11-05 01:13:03 +08:00
tasks: ['clean:build','exec:build_sphinx']
2013-11-04 05:37:56 +08:00
},
2015-09-09 15:17:10 +08:00
/* JavaScript */
browserify: {
files: ['js/*.js'],
tasks: ['browserify:dev']
},
/* live-reload the demo_docs if sphinx re-builds */
2013-11-04 05:37:56 +08:00
livereload: {
files: ['demo_docs/build/**/*'],
options: { livereload: true }
}
}
});
grunt.loadNpmTasks('grunt-exec');
2013-11-04 05:37:56 +08:00
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
2013-11-04 05:37:56 +08:00
grunt.loadNpmTasks('grunt-contrib-clean');
2014-02-01 00:58:37 +08:00
grunt.loadNpmTasks('grunt-contrib-copy');
2013-11-04 05:59:15 +08:00
grunt.loadNpmTasks('grunt-open');
2015-09-09 15:17:10 +08:00
grunt.loadNpmTasks('grunt-browserify');
2014-02-01 00:58:37 +08:00
grunt.registerTask('fonts', ['clean:fonts','copy:fonts']);
2015-09-09 15:17:10 +08:00
grunt.registerTask('default', ['exec:bower_update','clean:build','sass:dev','browserify:dev','exec:build_sphinx','connect','open','watch']);
grunt.registerTask('build', ['exec:bower_update','clean:build','sass:build','browserify:build','exec:build_sphinx']);
}