gruntjs

How to transform a npm script to a grunt task?

大憨熊 提交于 2019-12-06 06:03:52
I have the following script with my nodeJS. "scripts": { "start": "grunt", "test": "node --debug --harmony node_modules/grunt-cli/bin/grunt test" } I am running node v0.11.13 so I need to set --harmony flag. On grunt the tests are configured right if I start them with npm test, but I would prefer to have it all in a gruntfile. Is there a way to configure grunt to start the server and also run the test ? You can create an alias task that spawns grunt with those node flags, like such: grunt.registerTask('debug', function() { var done = this.async(); // Specify tasks to run spawned var tasks =

Grunt - How to update html files references within js files using grunt cache bust?

余生长醉 提交于 2019-12-06 05:39:01
In my js files I have references to HTML files, like window.location. I would like grunt cache bust to update that reference and add the hash data, so the loaded page is the right one, the one that uses the right versioned file. For example: window.location = 'myweb.html'; > window.location = 'myweb.html?575a2aa1158af941?575a2aa9658af941'; I can't find any configuration of the cache bust that allows me to write within the js file. In my Gruntfile.js I have added the assets and the scr files that must be written, without success. I can't find any configuration of the cache bust that allows me

HTML comments causing an issue exporting CSS files with Grunt-usemin

余生长醉 提交于 2019-12-06 05:29:50
I'm using yeoman/grunt to for my build process and I'm running into an issue. I'm trying to build two .css files, one for IE8 and one for everything else. If I place the IE conditional on the outside of the build block, an error is thrown because of the comment within a comment. If I put the IE conditional on the inside it gets stripped out. <!--[if lte IE 8]> <!-- build:css({.tmp,app}) styles/main-old-ie.css --> <link rel="stylesheet" href="styles/main-old-ie.css"> <!-- endbuild --> <![endif]--> <!--[if gt IE 8]><!--> <!-- build:css({.tmp,app}) styles/main.css --> <link rel="stylesheet" href=

Use requirejs to load a file with several classes inside (grunt-concat)

ぃ、小莉子 提交于 2019-12-06 05:16:32
I have a little problem with grunt concat and requirejs (and typescript). The problem is simple, when I generated one file per class and I load each file seperately, I don't have problem. (But it's slower for the browser) Example: A.js Message.js ValidatorMessage.js (extends Message and has a dependency) loader.ts: require.config({ paths: { 'A': '../generated/shared/A.min', 'Message': '../generated/shared/Message.min', 'ValidatorMessage': '../generated/shared/ValidatorMessage.min', }//more That's works. I can require() each file in the browser and I get it. But if do: require.config({ paths: {

Grunt compass task not compatible with this directory structure?

倖福魔咒の 提交于 2019-12-06 05:11:16
I have the following directory structure (only showing the relevant bits for illustration purposes): proj \ \ Gruntfile.js \ package.json \ test \ (all my tests are in this folder structure) \ app \ \ index.html \ scripts \ (all my scripts are in here) \ views \ (all views are in here) \ styles \ \ style.css \ oldie.css \ print.css \ images \ \ hires \ (all high resolution images are here) \ lowres \ (all low resolution images are here) The compass section of my Gruntfile.js file looks like this: compass: { options: { require: "susy", sassDir: '<%= my.app %>/styles', cssDir: '.tmp/styles',

Yeoman - task “requirejs” not found

空扰寡人 提交于 2019-12-06 05:07:44
I'm having problems with yeoman, specifically, when I try to run grunt, it fails on the requirejs, stating simply that "The task 'requirejs' doesn't exist". That is really strange, since in my gruntfile I have the options definition for requirejs, and I also have it installed in the package.json file. Do you know what could be the problem? Thank you! // Generated on 2013-03-14 using generator-webapp 0.1.5 "use strict"; var lrSnippet = require("grunt-contrib-livereload/lib/utils").livereloadSnippet; var mountFolder = function(connect, dir) { return connect.static(require("path").resolve(dir));

grunt-bower-task and Polymer

末鹿安然 提交于 2019-12-06 04:59:38
问题 I cannot seem to find an easy way to copy all the files from Polymer to using grunt-bower-task . grunt.initConfig({ bower: { install: { options: { targetDir: 'wwwroot/lib', layout: 'byComponent', install: true, copy: true, verbose: true, cleanTargetDir: false, bowerOptions: {} } } } I understand that only the main files defined inside each element's bower.json file get copied over. I am also aware that I could put a exportsOverride section in my own bower.json to include more files like this

npm install -g grunt-cli failed in Linux

萝らか妹 提交于 2019-12-06 04:49:32
I try to run next command in Linux : npm install -g grunt-cli The message I get is next: npm http GET https://registry.npmjs.org/grunt-cli npm ERR! Error: failed to fetch from registry: grunt-cli npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12 npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9) npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18) npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22) npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58) npm ERR! at

How to use minified javascript?

江枫思渺然 提交于 2019-12-06 04:29:19
I have a grunt tasks to concat and minify all my javascript files into one single file and the javascript file is in dist folder. "dist/<%= pkg.name %>.min.js'" "Gruntfile.js" module.exports = function (grunt) { grunt.initConfig({ pkg: grunt.file.readJSON("package.json"), concat: { options: { separator: ';' }, dist: { src: ['src/main/resources/app/js/**/*.js', 'src/main/resources/app/config/*.js', 'src/main/resources/app/app/js'], dest: 'dist/<%= pkg.name %>.js' } }, uglify: { options: { banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n' }, dist: { files: { 'src/main

bower add Jquery UI theme in style

早过忘川 提交于 2019-12-06 04:25:45
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 . This is not issue with library . its in Grunt-wiredep which has problem in injecting dependencies which has file name like jquery-ui,socket-io