Last active
August 29, 2015 14:03
-
-
Save jamesflorentino/a6f03349553ca6e8bb36 to your computer and use it in GitHub Desktop.
My solution to enabling livereload with connect-assets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to be used in jade | |
app.set('dev', app.get('env') === 'development'); | |
// to be used as temporary folder | |
app.use('/tmp', express.static(__dirname + '/.tmp')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.initConfig({ | |
watch: { | |
stylus: { | |
files: ['assets/css/**/*.styl'], | |
tasks: ['stylus'] | |
}, | |
css: { | |
files: ['.tmp/app.css'], | |
options: { livereload: true } | |
} | |
}, | |
stylus: { | |
compile: { | |
options: { | |
use: [require('nib')] | |
}, | |
files: [ {'.tmp/app.css': 'assets/css/app.styl'} ] | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-stylus'); | |
grunt.registerTask('default', ['stylus', 'watch']); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html | |
head | |
if local.settings.dev | |
link(href='/tmp/app.css', rel='stylesheet') | |
script(src="//localhost:35729/livereload.js") | |
else | |
!= css('app') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment