Set NODE_ENV in grunt dev task to serve non-minified assets

This commit is contained in:
Nick O'Leary 2015-05-11 20:24:15 +01:00
parent f11b906fd9
commit 0bef04ae0a
3 changed files with 12 additions and 2 deletions

View File

@ -340,6 +340,13 @@ module.exports = function(grunt) {
}
}
});
grunt.registerTask('setDevEnv',
'Sets NODE_ENV=development to non-minified assets are used',
function () {
process.env.NODE_ENV = 'development';
});
grunt.registerTask('default',
'Builds editor content then runs code style checks and unit tests on all components',
@ -363,7 +370,7 @@ module.exports = function(grunt) {
grunt.registerTask('dev',
'Developer mode: run node-red, watch for source changes and build/restart',
['build','concurrent:dev']);
['build','setDevEnv','concurrent:dev']);
grunt.registerTask('release',
'Create distribution zip file',

View File

@ -177,7 +177,7 @@
<script src="vendor/vendor.js"></script>
<script src="vendor/ace/ace.js"></script>
<script src="vendor/ace/ext-language_tools.js"></script>
<script src="red/red.min.js"></script>
<script src="{{ asset.red }}"></script>
</body>
</html>

View File

@ -28,6 +28,9 @@ var defaultContext = {
header: {
title: "Node-RED",
image: "red/images/node-red.png"
},
asset: {
red: (process.env.NODE_ENV == "development")? "red/red.js":"red/red.min.js"
}
};