码迷,mamicode.com
首页 > 其他好文 > 详细

hrap + browsersync

时间:2016-04-20 11:28:01      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:

https://github.com/superhighfives/harp-gulp-browsersync-boilerplate

https://gist.github.com/geelen/a5fcb013de67f680cb8d

gulp配置

var gulp        = require(‘gulp‘);
var browserSync = require(‘browser-sync‘);
var reload      = browserSync.reload;
var harp        = require(‘harp‘);

/**
* Serve the Harp Site from the src directory
*/
gulp.task(‘serve‘, function () {
  harp.server(__dirname + ‘/app‘, {
    port: 9000
  }, function () {
    browserSync({
      proxy: "localhost:9000",
      open: false,
      /* Hide the notification. It gets annoying */
      notify: {
        styles: [‘opacity: 0‘, ‘position: absolute‘]
      }
    });
    /**
     * Watch for scss changes, tell BrowserSync to refresh main.css
     */
    gulp.watch("app/**/*.scss", function () {
      reload("main.css", {stream: true});
    });
    /**
     * Watch for all other changes, reload the whole page
     */
    gulp.watch(["./*.js","./app/*.ejs", "./app/js/*.js",‘./app/partials/*.ejs‘,‘./app/*.json‘], function () {
      reload();
    });
  })
});

/**
* Default task, running just `gulp` will compile the sass,
* compile the harp site, launch BrowserSync & watch files.
*/
gulp.task(‘default‘, [‘serve‘]);

hrap + browsersync

标签:

原文地址:http://www.cnblogs.com/lihuazhidao/p/5411612.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!