gruntjs

I'm trying out Grunt and need a simple way to concatenate my modules

时光总嘲笑我的痴心妄想 提交于 2019-12-18 14:50:20
问题 This is my first time using Grunt and I'd like to have it combine all my js modules, each of which is wrapped in an immediately executing function, containing a 'use strict' declaration and put them into one file, wrapped up in only one immediately executing function, with only one 'use strict' declaration. How is this normally done? I figured this would be a common use case? Perhaps I'm going about things the wrong way? Should I be using one of the module loading formats (i.e. commonjs, amd)

How to match every file but one in grunt concat?

余生长醉 提交于 2019-12-18 14:05:11
问题 I'm using grunt to concatenate and minimize my js files, I use the following config for the concat part: concat: { dist: { src: ['<banner:meta.banner>', 'js/*.js'], dest: 'js/script.js' } } It matches every file in my js folder but I need to ignore modernizr.js , is there a way to do this? I assume I'd need some pattern matching voodoo to do it but I'm not sure how. Thanks in advance. 回答1: Based on documentation I would try: js/!(modernizr).js (js/)!(modernizr).js {js/}!(modernizr).js js/!(

Continue certain tasks in grunt even if one fails

孤街醉人 提交于 2019-12-18 14:03:39
问题 Is there a way to configure a sequence of tasks so that specific subsequent ones (I don't want --force on the whole batch) run even if one fails? For example, consider a case like this Create some temporary files Run some unit tests which involve those temporary files Clean up those temporary files I can do this: grunt.registerTask('testTheTemp', ['makeTempFiles', 'qunit', 'removeTempFiles']); But if qunit fails then the removeTempFiles task never runs. 回答1: Here's one workaround. It's not

Image address in ember templates grunt build

元气小坏坏 提交于 2019-12-18 13:35:55
问题 I used Yeoman to create a web app in EmberJS. Everything works ok, but after using the grunt build command, if I view the built app in the browser (from dist directory), I can see that some images are missing because the src path is wrong. Grunt is changing the names of all images in the "image" folder, but not updating the paths in my HTML. It updates the path only in css files; the images in the .hbs template files still have the old path (with the old image name)... Anyone know how to fix

Difficulty getting browserify-shim working with grunt-browserify (> 2.0.2) as transform

血红的双手。 提交于 2019-12-18 12:24:36
问题 In version 2.0.2 of grunt-browserify , browserify-shim was removed from the module itself and converted to be used as a transform , rather than a straightforward option on a grunt-browserify task. The old version of using the shim with grunt-browserify would look as such: 'libs-dev': { src: [path.join('<%= config.dirs.browserLibs %>', 'angular', 'angular.js')], dest: path.join('<%= config.dirs.dest.dev %>', 'js', 'libs.js'), options: { shim: { angular: { path: path.join('<%= config.dirs

grunt-concat separator option?

扶醉桌前 提交于 2019-12-18 12:23:56
问题 how to specify a separator in this scenario: I'm concatenating my files with grunt-concat this way: concat: { options: { banner: '<%= banner %>', separator: "" }, dist: { files:{ '<%= distdir %>/public/scripts/ieditor.js': [ 'public/scripts/ieditor/vars.js', 'public/scripts/ieditor/controllers/*.js', 'public/scripts/ieditor/directives/*.js', 'public/scripts/ieditor/app.js', 'public/scripts/ieditor/services/*.js', 'public/scripts/ieditor/filters/*.js' ], '<%= distdir %>/public/scripts

bower or grunt keeps removing jquery from index.html

旧街凉风 提交于 2019-12-18 12:17:41
问题 This is driving me crazy. So far Bower+Grunt (via Yeoman) has been a major source of frustration and a waste of time. All I want is my app to use the latest (2.1.0) version of jquery. bower list correctly reported jquery 2.1.0 as an official update. I ran bower install --save jquery to update to the last version, which it did. The bower list command now correctly reports jquery#2.1.0 as a dependency, and the bower.json file now correctly lists jquery with the wanted version as a dependency: {

How to use Sass inside a Polymer component

假装没事ソ 提交于 2019-12-18 11:53:47
问题 I'm currently using Polymer as my front end development framework. I love SASS. Now I understand I can create a Sass file and import it like I normally would. However, I've really gotten into the habit of using style tags within my web components. Basically the workflow I am looking for is to be able to simply define a script tag within my Web Component maybe add type='sass; to it. Then have grunt go through and compile all of my SASS within those tags before outputting the files to my .tmp

Running grunt task with api, without command line

萝らか妹 提交于 2019-12-18 10:54:23
问题 I want to create and run grunt task in node.js code for test use. var foo = function() { var grunt = require("grunt"); var options = {"blahblah": null} // ...creating dynamic grunt options, such as concat and jshint grunt.initConfig(options); grunt.registerTask('default', [/*grunt subtasks*/]); } But this doesn't work. Grunt doesn't seem to run any task. I'm almost sure that there is some API to run grunt task externally without command line, but don't know how to do it. Is there any way to

No provider for “framework:jasmine”! (Resolving: framework:jasmine)

我的未来我决定 提交于 2019-12-18 10:01:04
问题 When I run the command grunt I get the following warning: Running "karma:unit" (karma) task Warning: No provider for "framework:jasmine"! (Resolving: framework:jasmine) Use --force to continue. Does anybody know how to resolve this issue? 回答1: I had the same error after creating a new project the yeoman angular generator (yo angular). The solution for me was adding "karma-jasmine" to the devDependencies in packages.json and running "npm install" again. npm install karma-jasmine --save-dev