gruntjs

Grunt multi-tasks throwing EISDIR error when building

时光总嘲笑我的痴心妄想 提交于 2019-12-07 03:34:13
问题 I am trying to set up grunt to minify a number of js files in a src directory and copy them to a build directory. Following the grunt task documentation, I believe the below configuration should work. uglify: { dist: { files: [ { expand: true, // Enable dynamic expansion. cwd: 'src/js/', // Src matches are relative to this path. src: ['**/?.js'], // Actual pattern(s) to match. dest: 'build/minified/', // Destination path prefix. ext: '.min.js' // Dest filepaths will have this extension. } ] }

Using almond with grunt-contrib-requirejs

邮差的信 提交于 2019-12-07 02:34:23
问题 I'm trying to set up a gruntfile that utilizes requirejs and almond. The docs suggest it should be really easy, and following their lead, I tried: requirejs: { compile: { options: { baseUrl: "tmp", mainConfigFile: "tmp/main.js", name: "../bower_components/almond/almond", out: "tmp/<%= pkg.name %>.js" } } } Unfortunately, this approach compiles almond.js rather than my actual source. Am I getting something wrong? How do I automate almond along with requirejs? 回答1: The trick is to use include:

grunt requirejs ignores paths from my mainConfigFile

谁说胖子不能爱 提交于 2019-12-07 01:13:57
问题 Project Intro My project is a single page storefront. The project has multiple modules, and each module contains a set of controller.js, view.js and model.js files, as well as a template.html file. And uses requirejs to manage dependencies. Problem Statement I want to use mainConfigFile to provide paths to reference modules in grunt-requirejs. Part of my mainConfigFile's require.config is stored in separate file (base.dependency.config), and require.config.paths are pieced together by

Execute shell script in gruntfile and assign result to variable

纵然是瞬间 提交于 2019-12-07 01:00:46
问题 I am using grunt to manage a suite of mocha-run tests. One of the things required in the mocha test suite is that certain environment variables be set so that the tests are executed properly based on the environment of the developer running the tests. One of these environment variables will have a different value on every developer's machine, so we execute a bash script to return that value for the environment variable we are setting. I am using grunt.util.spawn to run the script and assign

How can I install the grunt-cli without getting errors?

我们两清 提交于 2019-12-06 22:27:35
问题 Inspired by Chris Coyier's post, I decided I'd give grunt a go. But I'm having big problems getting set up. First, I installed Node. Then I added a package.json file to my project root, including this: { "name": "example-project", "version": "0.1.0", "devDependencies": { "grunt": "~0.4.1" } } Then I ran npm install Finally, I ran npm install -g grunt-cli which came back with a ton of errors: npm http GET https://registry.npmjs.org/grunt-cli npm http 304 https://registry.npmjs.org/grunt-cli

Grunt & requirejs optimizer for a multi app project

你。 提交于 2019-12-06 20:58:02
问题 I'm having issues getting Grunt to perform requirejs optimization on a project with the following structure: static/js |── apps |── app.js |── dash.js |── news.js ... (many more 'app' files) |── build |── collections |── libs |── models |── util |── views Each of static/js/apps/*.js should be compiled to static/js/build/*.js containing the relevant dependencies (eg. views/view1 , libs/query etc). This is currently being performed by a basic bash script: JS_ROOT="static/js" for f in ${JS_ROOT}

'grunt' command doesn't do anything

北战南征 提交于 2019-12-06 19:05:03
问题 I'm following the grunt getting started guide for my new app, but I'm having some trouble. This is my Gruntfile.js module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: {, build: { src: 'js/*.js', dest: 'build/*.min.js' } } }); // Load the plugin that provides the "uglify" task. grunt.loadNpmTasks('grunt-contrib-uglify'); // Default task(s). grunt.registerTask('default', ['uglify']); }; This is my package.json { "name

requires a peer of grunt@>=0.4.0

那年仲夏 提交于 2019-12-06 18:41:48
问题 Why do I get the error below? My grunt version is > v0.4.0 npm install grunt-contrib-concat --save-dev +-- UNMET PEER DEPENDENCY grunt@>=0.4.0 Error messages: ..Projects\Hartz\Hartz>npm install grunt-contrib-concat --save-dev Hartz@1.0.0 C:..\Projects\Hartz\Hartz +-- UNMET PEER DEPENDENCY grunt@>=0.4.0 `-- grunt-contrib-concat@1.0.1 npm WARN grunt-contrib-jshint@1.0.0 requires a peer of grunt@>=0.4.0 but none was installed. npm WARN grunt-contrib-concat@1.0.1 requires a peer of grunt@>=0.4.0

Grunt - delete all files and files in sub-directories with specific file extension

百般思念 提交于 2019-12-06 18:31:47
问题 I need to delete all files with a specific file extension in a directory and all of its sub-directories using Grunt.js and I guess I probably need a module to do so? I've looked at clean but that seems to be for deleting whole directories rather than specific files. My directory looks like: build/img/ build/img/ico build/img/logos and the file extension I want to delete is: Any file with the extension of .png~ , .gif~ or .jpg~ Any ideas? 回答1: You can configure the grunt-contrib-clean task to

Run grunt server with various browsers

坚强是说给别人听的谎言 提交于 2019-12-06 18:28:03
问题 Is it possible to specify a particular browser (besides the OS' default) in the gruntfile or at the command prompt? E.g. "grunt server firefox" or the like. My default browser is Chrome, but I want to test/develop my site in multiple browsers. I am using GruntJS within Yeoman. Bryan 回答1: Quick Answer In Gruntfile.js you can add an app parameter: open: { server: { url: 'http://localhost:<%= connect.options.port %>', app: 'firefox' } }, Pull request: https://github.com/jsoverson/grunt-open/pull