Skip to content

Commit

Permalink
Merge pull request #73 from silvenon/connect
Browse files Browse the repository at this point in the history
Compile styles to .tmp folder
  • Loading branch information
sindresorhus committed Apr 14, 2014
2 parents 3c6aeb9 + f228768 commit 09a4dee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
27 changes: 11 additions & 16 deletions app/templates/gulpfile.js
Expand Up @@ -6,24 +6,17 @@ var gulp = require('gulp');
// load plugins
var $ = require('gulp-load-plugins')();

<% if (includeSass) { %>
gulp.task('styles', function () {
gulp.task('styles', function () {<% if (includeSass) { %>
return gulp.src('app/styles/main.scss')
.pipe($.rubySass({
style: 'expanded'
}))
.pipe($.autoprefixer('last 1 version'))
.pipe(gulp.dest('app/styles'))
.pipe($.size());
});
<% } else { %>
gulp.task('styles', function () {
return gulp.src('app/styles/main.css')
}))<% } else { %>
return gulp.src('app/styles/main.css')<% } %>
.pipe($.autoprefixer('last 1 version'))
.pipe(gulp.dest('app/styles'))
.pipe(gulp.dest('.tmp/styles'))
.pipe($.size());
});
<% } %>

gulp.task('scripts', function () {
return gulp.src('app/scripts/**/*.js')
.pipe($.jshint())
Expand Down Expand Up @@ -69,7 +62,7 @@ gulp.task('fonts', function () {
});

gulp.task('clean', function () {
return gulp.src(['dist'], { read: false }).pipe($.clean());
return gulp.src(['.tmp', 'dist'], { read: false }).pipe($.clean());
});

gulp.task('build', ['html', 'images', 'fonts']);
Expand All @@ -83,6 +76,7 @@ gulp.task('connect', function () {
var app = connect()
.use(require('connect-livereload')({ port: 35729 }))
.use(connect.static('app'))
.use(connect.static('.tmp'))
.use(connect.directory('app'));

require('http').createServer(app)
Expand Down Expand Up @@ -117,17 +111,18 @@ gulp.task('wiredep', function () {
gulp.task('watch', ['connect', 'serve'], function () {
var server = $.livereload();

// watch for changes in the `app` folder
// watch for changes

gulp.watch([
'app/*.html',
'app/styles/**/*.css',
'.tmp/styles/**/*.css',
'app/scripts/**/*.js',
'app/images/**/*'
]).on('change', function (file) {
server.changed(file.path);
});

gulp.watch('app/styles/**/*.<%= includeSass ? 'sass' : 'css' %>', ['styles']);
gulp.watch('app/styles/**/*.<%= includeSass ? 'scss' : 'css' %>', ['styles']);
gulp.watch('app/scripts/**/*.js', ['scripts']);
gulp.watch('app/images/**/*', ['images']);
gulp.watch('bower.json', ['wiredep']);
Expand Down
2 changes: 1 addition & 1 deletion app/templates/index.html
Expand Up @@ -12,7 +12,7 @@
<!-- endbower -->
<!-- endbuild -->

<!-- build:css styles/main.css -->
<!-- build:css({.tmp,app}) styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
<% if (includeModernizr) { %>
Expand Down

0 comments on commit 09a4dee

Please sign in to comment.