javascript - How do I serve a Jekyll site locally with Grunt BrowserSync and watch for Sass and Jekyll changes? -
i trying boilerplate template setup using grunt, browserssync, jekyll , sass.
i have been working on , off of couple of days , there tripping point. hoping has experience , can point me in right direction.
i not picky on particular plugins, more desired outcome being expected.
i want runt grunt
task , serve site using browsersync watch changes on sass , jekyll related files, if changes, update browser.
i working on windows machine may make difference have seen done lot grunt-shell
.
the current code follows:
'use strict'; module.exports = function (grunt) { grunt.initconfig({ pkg: grunt.file.readjson('package.json'), // grunt jekyll jekyll: { build: { dest: "_site" } }, // grunt sass sass: { options: { sourcemap: true }, dist: { files: { 'dist/css/style.css': 'scss/index.scss' } } }, // grunt contrib watch watch: { sass: { files: ['scss/**/**/*.scss'], tasks: ['sass'] }, jekyll: { files: ['**/*.html', '**/**/*.md', 'dist/css/*.css'], tasks: ['jekyll'] } }, // grunt browsersync browsersync: { dev: { bsfiles: { src: ['_site/dist/css/style.css', '_site/**/*.html'] }, options: { watchtask: true, server: '_site' } } } }); // load grunt plugins grunt.loadnpmtasks('grunt-contrib-watch'); grunt.loadnpmtasks('grunt-jekyll'); grunt.loadnpmtasks('grunt-sass'); grunt.loadnpmtasks('grunt-browser-sync'); // register tasks grunt.registertask('build', ['sass', 'jekyll']); grunt.registertask('default', ['build', 'browsersync', 'watch']); };
i no expert grunt please go easy if there wrong.
thanks looking...
Comments
Post a Comment