Created
January 27, 2015 21:12
-
-
Save leosuncin/e130a0bdea2fb9a410da to your computer and use it in GitHub Desktop.
Configure livereload support to sails.js
This file contains 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
// config/env/development.js | |
/** | |
* Development environment settings | |
* | |
* This file can include shared settings for a development team, | |
* such as API keys or remote database passwords. If you're using | |
* a version control solution for your Sails app, this file will | |
* be committed to your repository unless you add it to your .gitignore | |
* file. If your repository will be publicly viewable, don't add | |
* any private information to this file! | |
* | |
*/ | |
module.exports = { | |
/*************************************************************************** | |
* Set the default database connection for models in the development * | |
* environment (see config/connections.js and config/models.js ) * | |
***************************************************************************/ | |
livereloadPath: '//localhost:35729/livereload.js' | |
}; |
This file contains 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
<!-- views/layouts/layout.ejs --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- Head --> | |
<!--STYLES--> | |
<!--STYLES END--> | |
</head> | |
<body> | |
<!-- Content --> | |
<!--TEMPLATES--> | |
<!--TEMPLATES END--> | |
<% if (sails.config.livereloadPath) { %> | |
<script src="<%= sails.config.livereloadPath %>"></script> | |
<% } %> | |
<!--SCRIPTS--> | |
<!--SCRIPTS END--> | |
</body> | |
</html> |
This file contains 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
// tasks/config/watch.js | |
/** | |
* Run predefined tasks whenever watched file patterns are added, changed or deleted. | |
* | |
* --------------------------------------------------------------- | |
* | |
* Watch for changes on | |
* - files in the `assets` folder | |
* - the `tasks/pipeline.js` file | |
* and re-run the appropriate tasks. | |
* | |
* For usage docs see: | |
* https://github.com/gruntjs/grunt-contrib-watch | |
* | |
*/ | |
module.exports = function(grunt) { | |
grunt.config.set('watch', { | |
api: { | |
// API files to watch: | |
files: ['api/**/*'] | |
}, | |
assets: { | |
// Assets to watch: | |
files: ['assets/**/*', 'tasks/pipeline.js', 'views/**/*'], | |
options: { | |
livereload: true | |
}, | |
// When assets are changed: | |
tasks: ['syncAssets' , 'linkAssets'], | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment