gruntjs

Grunt-cli and Grunt - Same app, two versions?

蹲街弑〆低调 提交于 2019-12-03 10:52:35
问题 Achtung! The accepted answer answered my question at the time, but is now outdated. Back then grunt-cli used grunt, but with another branch. The not-accepted answers will tell you how it is today. Question What is the relations and differences between grunt-cli and grunt? It seems to be the same thing, but different versions. Grunt https://npmjs.org/package/grunt https://github.com/gruntjs/grunt Grunt-cli https://npmjs.org/package/grunt-cli https://github.com/gruntjs/grunt/blob/devel/docs

Is there an injector like grunt-wiredep that works for NPM dependencies?

落花浮王杯 提交于 2019-12-03 10:47:32
问题 Most packages nowadays are available in both NPM and Bower. I have to have NPM around, but I'd like cut Bower out of the loop on my project. I'm currently relying on grunt-wiredep to create <script> includes in my index.html . This tool looks at all of the Bower configs to pull all the necessary js and css files into my index.html for me. Is there a tool that will do the same for NPM dependencies? 回答1: You would be able to do that using a module bundler like Browserify or Webpack. For getting

grunt-contrib-cssmin - how to remove comments from minified css

夙愿已清 提交于 2019-12-03 10:39:57
Im using cssmin to minify css files. my config like this: module.exports = function(grunt) { grunt.config.set('cssmin', { site: { src: ['.tmp/public/concat/site.css'], dest: '.tmp/public/min/site.min.css' } }); grunt.loadNpmTasks('grunt-contrib-cssmin'); }; But output minified css files has comments. Is it possible to configure cssmin to remove comment from source css files? Thank you. Set keepSpecialComments to zero, for removing all comments. grunt.config.set('cssmin', { options: { keepSpecialComments: 0 }, site: { src: ['.tmp/public/concat/site.css'], dest: '.tmp/public/min/site.min.css' }

Grunt - read json object from file

让人想犯罪 __ 提交于 2019-12-03 10:19:47
I want to use grunt-hash plugin for renaming my js files. This plugin create a new file containing map of renamed files: hash: { options: { mapping: 'examples/assets.json', //mapping file so your server can serve the right files Now I need to fix links to this files by replacing all usages (rename 'index.js' to 'index-{hash}.js') so I want to use grunt-text-replace plugin. According to documentation I need to cofigure replacements: replace: { example: { replacements: [{ from: 'Red', // string replacement to: 'Blue' }] } } How could I read json mapping file to get {hash} values for each file

How to copy compiled jade files to a destination folder using grunt

佐手、 提交于 2019-12-03 10:19:35
问题 For a single page app that I'm working on, I have the following structure: dist css js lib partials index.html src css js lib views partials index.jade Directory dist will be used by the express server to serve the project. I have trivial grunt tasks (using grunt-contrib-clean , grunt-contrib-copy ) for cleaning dist and copying src/css , src/js , src/lib to dist . The problem lies with src/views . This directory contains jade files which need to be compiled to html files. After compilation I

Cannot install phantomJS in Karma

Deadly 提交于 2019-12-03 09:28:04
WARN [config]: config.configure() is deprecated, please use config.set() instead. WARN [plugin]: Cannot find plugin "karma-phantomjs". Did you forget to install it ? npm install karma-phantomjs --save-dev INFO [karma]: Karma v0.10.2 server started at http://localhost:9018/ WARN [launcher]: Can not load "PhantomJS", it is not registered! Perhaps you are missing some plugin? Getting this error. When running npm install karma-phantomjs --save-dev I get an error. npm ERR! 404 'karma-phantomjs' is not in the npm registry. I installed karma-phantomjs-launcher --save-dev but i still get an error when

How do I run grunt from a different folder than my root project

点点圈 提交于 2019-12-03 09:04:25
问题 Is there a way to tell grunt which grunt.js file to use? I have an f:\a\b\tools folder that contains grunt.cmd, node.exe,... , my actual web app with GruntFile.js and all the local node_modules is in f:\a\c\my_app Running grunt from a\c\my_app works fine but trying to run grunt from some other folder say a does not seem to work. I am new to grunt and may be I am missing something obvious. f:\a>grunt --config c\GruntFile.js grunt-cli: The grunt command line interface. (v0.1.6) Fatal error:

GruntJS - wrong image paths after grunt build

人走茶凉 提交于 2019-12-03 08:58:44
Grunt is messing my minified CSS and I cannot figure out why and how to avoid it. To be brief, before the minification I have some background images like this: .head-image { height: 380px; background: url("../images/head1_bg.png") repeat-x; -webkit-background-size: cover; background-size: cover; } Then, after the whole process, I have a minified CSS that goes like this (snippet): [...]background:url(/home/domo/projects/lp/.tmp/images/head1_bg.png) repeat-x;background-size:cover}[...] The aforementioned path not only is an absolute path, but it's even wrong, since the images can be found in

Node js as http server and host angularJS SPA

*爱你&永不变心* 提交于 2019-12-03 08:56:19
问题 I have an application written on angularJS and built by grunt. Is there a way I can create a http server from node js and host it there. Please share any code snippet or document which would help. Thanks 回答1: (simplest) if you don't have any server side logic, you can simply serve client side AngularJS/HTML/css via http-server module from npm. https://www.npmjs.com/package/http-server Just install it via $>npm install -g http-server and go to your client folder, type http-server and hit enter

How do I fix my generator-angular project so that grunt test works?

此生再无相见时 提交于 2019-12-03 08:14:36
问题 I am working off of this tutorial: http://www.sitepoint.com/kickstart-your-angularjs-development-with-yeoman-grunt-and-bower/ as a means to understand what files are created using yo generator-angular. I have experience using AngularJS, but was looking for a way to get a best-practices directory set up; I am not sure how to set up dependencies and get karma running on my own, hence using the yeoman generator. However, straight out of the box, without editing anything else, when I run grunt