Browse Source

Merge pull request #618 from watilde/integrate-grunt-task

Integrate `grunt-contrib-connect` for easier local development
pull/610/merge
XhmikosR 10 years ago
parent
commit
c24c4cc50d
  1. 42
      Gruntfile.js
  2. 1
      package.json

42
Gruntfile.js

@ -26,7 +26,9 @@ module.exports = function (grunt) {
meta: { meta: {
distPath: 'dist/', distPath: 'dist/',
docsAssetsPath: 'docs/assets/', docsAssetsPath: 'docs/assets/',
docsPath: 'docs/dist/', docsDistPath: 'docs/dist/',
docsPath: 'docs/',
jsPath: 'js/',
srcPath: 'sass/' srcPath: 'sass/'
}, },
@ -41,7 +43,7 @@ module.exports = function (grunt) {
' */\n', ' */\n',
clean: { clean: {
dist: ['<%= meta.distPath %>', '<%= meta.docsPath %>'] dist: ['<%= meta.distPath %>', '<%= meta.docsDistPath %>']
}, },
concat: { concat: {
@ -139,7 +141,7 @@ module.exports = function (grunt) {
src: [ src: [
'**/*' '**/*'
], ],
dest: '<%= meta.docsPath %>' dest: '<%= meta.docsDistPath %>'
} }
}, },
@ -226,11 +228,22 @@ module.exports = function (grunt) {
}, },
watch: { watch: {
scripts: { options: {
files: [ hostname: 'localhost',
'<%= meta.srcPath %>**/*.scss' livereload: true,
], port: 8000
tasks: ['sass'] },
js: {
files: '<%= meta.jsPath %>**/*.js',
tasks: ['dist-js', 'copy']
},
css: {
files: '<%= meta.srcPath %>**/*.scss',
tasks: ['dist-css', 'copy']
},
html: {
files: '<%= meta.docsPath %>**',
tasks: ['jekyll']
} }
}, },
@ -310,6 +323,18 @@ module.exports = function (grunt) {
replacement: grunt.option('newver'), replacement: grunt.option('newver'),
recursive: true recursive: true
} }
},
connect: {
site: {
options: {
base: '_site/',
hostname: 'localhost',
livereload: true,
open: true,
port: 8000
}
}
} }
}); });
@ -325,6 +350,7 @@ module.exports = function (grunt) {
grunt.registerTask('build', ['dist']); grunt.registerTask('build', ['dist']);
grunt.registerTask('default', ['dist']); grunt.registerTask('default', ['dist']);
grunt.registerTask('test', ['dist', 'csslint', 'jshint', 'jscs', 'validate-html']); grunt.registerTask('test', ['dist', 'csslint', 'jshint', 'jscs', 'validate-html']);
grunt.registerTask('server', ['dist', 'jekyll', 'connect', 'watch']);
grunt.registerTask('build-ratchicons-data', generateRatchiconsData); grunt.registerTask('build-ratchicons-data', generateRatchiconsData);

1
package.json

@ -31,6 +31,7 @@
"grunt-banner": "~0.3.1", "grunt-banner": "~0.3.1",
"grunt-contrib-clean": "~0.6.0", "grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.5.0", "grunt-contrib-concat": "~0.5.0",
"grunt-contrib-connect": "~0.9.0",
"grunt-contrib-copy": "~0.7.0", "grunt-contrib-copy": "~0.7.0",
"grunt-contrib-csslint": "~0.4.0", "grunt-contrib-csslint": "~0.4.0",
"grunt-contrib-cssmin": "~0.11.0", "grunt-contrib-cssmin": "~0.11.0",

Loading…
Cancel
Save