Javascript variables in Gruntfile.js?
gruntjs, javascript, jquery
Solution
Another way, is to utilize Grunt templates:
grunt.initConfig({
path: 'C:/dist/',
uglify: {
options: {
mangle: false
},
'<%= path %>js/jsFile.js': ['src/js/jquery-1.10.2.min.js']
}
});
Problem
I'm maintaining a web application that uses Grunt extensively. I have to minify, copy my html, css, js files to different locations in different times. So to make it easy I created a simple javascript variable in my GruntFile.js as follows: ``` var path="C:/dist"; uglify: { options: { mangle: false }, my_target: { files: { path+'/js/jsFile.js': ['src/js/jquery-1.10.2.min.js'] } } } ``` When I am building this i am getting the following error `>> SyntaxError: Unexpected token +` Can't I Use path variable in my GruntFile.js. Because I have 10 location paths.