gruntjs

Can I tell UglifyJS to only compress and mangle all files except some which I only want concatenated?

自古美人都是妖i 提交于 2020-01-03 11:30:18
问题 Is it possible to specify and array of files that I want compressed and mangled (default Uglify behavior), but also a list of files that should not be touched, just concatenated? Thanks. 回答1: You can solve this in different ways. I'm posting an extended example to illustrate what one can do: uglify: { doAll: { options: { banner: '// <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd HH:mm:ss") %>\n\n', mangle: { except: [ // mangle is true for all else besides

Can I tell UglifyJS to only compress and mangle all files except some which I only want concatenated?

可紊 提交于 2020-01-03 11:30:07
问题 Is it possible to specify and array of files that I want compressed and mangled (default Uglify behavior), but also a list of files that should not be touched, just concatenated? Thanks. 回答1: You can solve this in different ways. I'm posting an extended example to illustrate what one can do: uglify: { doAll: { options: { banner: '// <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd HH:mm:ss") %>\n\n', mangle: { except: [ // mangle is true for all else besides

Grunt URL rewrite in Angular application on page reload

这一生的挚爱 提交于 2020-01-03 07:57:06
问题 Here's what the livereload block looks like in Grunt file: livereload: { options: { open: true, middleware: function(connect, options, middleware) { var optBase = typeof options.base === "string" ? [options.base] : options.base; return [ [ require("connect-modrewrite")(["!(\\..+)$ / [L]"]) ].concat( optBase.map(function(path) { return connect.static(path); }) ), connect.static(".tmp"), connect().use("/bower_components", connect.static("./bower_components")), connect().use("/app/styles",

Grunt Concat cannot write to file

耗尽温柔 提交于 2020-01-03 06:44:09
问题 Just installed latest Grunt on Ubuntu 12.04. Here is my gruntfile: module.exports = function(grunt){ //project configuration grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { slides : { src : ['src/top.html', 'src/bottom.html'], dest : ['build/index.html'] } } }); //enable plugins grunt.loadNpmTasks('grunt-contrib'); grunt.registerTask('default', ['concat:slides']); } This creates the build/ directory fine, but gives me the output of: Running "concat:slides" (concat) task

Handle dependent files with Grunt and rewrite paths

邮差的信 提交于 2020-01-03 05:55:06
问题 This is my Gruntfile.js ( assets is the Bower folder): module.exports = function(grunt) { grunt.initConfig({ distFolder: 'dist', pkg: grunt.file.readJSON('package.json'), concat: { options: { separator: ';', }, dist: { src: [ 'assets/jquery/dist/jquery.js', 'assets/jquery-ui/ui/jquery-ui.js', 'assets/jsplumb/dist/js/jquery.jsPlumb-1.5.5.js' ], dest: '<%= distFolder %>/main.js', }, }, uglify: { dist: { src: 'dist/main.js', dest: 'dist/main.min.js', }, }, cssmin: { combine: { files: { 'dist

grunt Unexpected token : error

落爺英雄遲暮 提交于 2020-01-03 05:52:53
问题 I followed http://gruntjs.com/getting-started to install grunt on my Ubuntu 11.10. When I ran grunt, I got this error: /opt/node-v0.10.0-linux-x64/lib/node_modules/grunt-cli/package.json:2 "name": "grunt-cli", ^ node.js:134 throw e; // process.nextTick error, or 'error' event on first tick ^ SyntaxError: Unexpected token : at Module._compile (module.js:397:25) at Object..js (module.js:408:10) at Module.load (module.js:334:31) at Function._load (module.js:293:12) at require (module.js:346:19)

Grunt/Yeoman Multiple Gruntfile.js Files

风流意气都作罢 提交于 2020-01-03 05:11:09
问题 My goal is the be able to build my project to two separate build folders, each with its' own Grunt tasks. I noticed the grunt-cli has the --gruntfile option which allows you to specify another Gruntfile to use. So far, I have a Gruntfile.js working perfectly (near stock from Yeoman). Also, I have another Gruntfile2.js sitting alongside. Gruntfile.js var yeomanConfig = { app: 'app', dist: '../www_browser' }; Gruntfile2.js var yeomanConfig = { app: 'app', dist: '../www' }; grunt build is meant

Why can't different servers bind to the same port?

谁都会走 提交于 2020-01-02 20:18:22
问题 I am confused about ports. I find it odd that we need to bind different servers to different ports. Example: Apache binded on 8080, Express.js can't bind on 8080 How does server port binding differ from application port listening? Example: Different browsers, ie, chrome, firefox, can listening and communicated on port 80? This issue came up when trying to run "grunt test:unit". There was a tomcat server that was already bound to 8080, but the server grunt starts, middleware I believe, is able

bower add Jquery UI theme in style

亡梦爱人 提交于 2020-01-02 10:03:52
问题 In my project I have included to jQuery UI.I am using Bower, Yeoman and Grunt. I added jQuery UI: bower install jquery-ui --save . but the jQuery UI theme was not included in Bower style components. <!-- build:css(.) styles/vendor.css --> <!-- bower:css --> <link rel="stylesheet" href="bower_components/components-font-awesome/css/font-awesome.css" /> <!-- endbower --> <!-- endbuild --> <!-- build:css(.tmp) styles/main.css -> Help me with this problem . 回答1: This is not issue with library .

Grunt - get current calling folder, and not gruntfile current folder

二次信任 提交于 2020-01-02 05:23:10
问题 If I have Grunt installed in some folder /foo, but my current folder is /foo/bar/baz, and I run "grunt sometask" from within my current folder, how can I get Grunt (or NodeJS for that matter) to determine my current path? That is to say, how can I programmatically GET the folder I was in when I called grunt? When I use process.cwd(), I get the path of the gruntfile, ie, "foo", which is not what I want. I don't have to do this in Grunt specifically, any nodejs-based solution would work. 回答1: