gruntjs

Passing variable to SASS with Grunt

我是研究僧i 提交于 2019-12-04 18:45:41
问题 I want to be able to "@import" a file with SASS depending on a Grunt parameter. With grunt I want to: grunt someTask --skinName=yellow Inside app.scss I want to somehow use this parameter: @import "$skinName"; Some context... This skinName.scss contains a lot of SASS variables with color codes so that I can easily change colors all over the app. I Should be included before all my SASS @imports. 回答1: You could solve this with another scss file that is written by grunt during the build process:

grunt-wiredep on multiple files with different dependencies

不打扰是莪最后的温柔 提交于 2019-12-04 18:45:13
问题 The current project structure is somewhat like this: -index.html | -bower.json | +-bower_components The proposed project structure will add a few more static html files in the project root. Till now I have been managing all the frontend dependencies in bower.json and had it automatically included in index.html using the grunt-wiredep task. But with new files getting added, each file will have different set of dependencies. -index.html | -file-with-some-other-bower-dependency.html | -bower

grunt-connect: serve files with base url added

只谈情不闲聊 提交于 2019-12-04 18:34:17
问题 I am developing jekyll-based site using grunt as my task manager. I am using grunt-contrib-connect to serve my files locally for development because of its livereload functionality. Those files are accessible in the browser at: http://localhost:8081/index.html On my server, my files are located within a sub-directory, so have a base url prepended to all urls: http://path.to.server/mysite/index.html I cannot figure out a way to simulate the base url on my local dev setup with grunt-connect.

Any equivalent gulp plugin for doing “grunt bower”?

有些话、适合烂在心里 提交于 2019-12-04 18:15:40
问题 With grunt , I could use command grunt bower (provided by grunt-bower-requirejs) to auto-generate RequireJS config file for my local bower components. Is there any plugin for gulp to perform similar task? 回答1: Mind that bowerRequireJS is an asynchronous function. So you would need to use a callback (or synchronously return a Promise) to mark that task as asynchronous like so: gulp.task('bower', function(callback) { var options = { baseUrl: 'src', config: 'src/app/require.config.js',

Jenkins script quitting prematurely when using npm install on Windows

时光怂恿深爱的人放手 提交于 2019-12-04 17:29:31
问题 In my Jenkins job I want to build a JavaScript app using Grunt. The Jenkins build scripts creates a build directory (if it doesn't already exist), changes to that directory and runs: npm install grunt npm install grunt-zip grunt --gruntfile=[something] (Of course grunt-cli is installed globally.) When I build the job, the first statement causes Grunt and dependencies to be pulled down as expected. However, the job then terminates successfully: Archiving artifacts No emails were triggered.

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

☆樱花仙子☆ 提交于 2019-12-04 16:42:56
问题 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. 回答1: Set keepSpecialComments to zero, for removing all comments. grunt.config.set('cssmin', { options: {

'grunt' is not recognized as an internal or external command for some windows users

橙三吉。 提交于 2019-12-04 16:11:07
问题 Grunt is not working for all Windows users. Some users are facing some issues, when I run npm install command; it prints a message as below. E:\Worksapce\web>npm install npm WARN package.json registers@4.0.0 No repository field. When I tried npm install -g grunt-cli , I think it is successful. E:\Worksapce\web>npm install -g grunt-cli npm http GET http://registry.npmjs.org/grunt-cli npm http 304 http://registry.npmjs.org/grunt-cli npm http GET http://registry.npmjs.org/nopt npm http GET http:

How do I add foundation with grunt to a ember.js app kit project

南楼画角 提交于 2019-12-04 15:11:17
I'm trying to setup my first Ember.js app with Ember AppKit , grunt, and compass. The appkit ships with support of compass out of the box via grunt-contrib-compass but I can't figure out for the life of me how to install Zurb-Foundation, or at least not "properly." As far as I can tell, grunt-contrib-compass doesn't provide a wrapper around compass's install method. I could duplicate the compass.js task settings for a compass config file but it seems like there should be a way to do this without duplicating the data. Alternatively, I guess I could just copy everything over manually but that

AngularJS with Grunt - Connect to another server

扶醉桌前 提交于 2019-12-04 14:52:22
I have created an AngularJS application using grunt, bower and yeoman. I guess the Gruntfile.js has changed after 2014 January (not sure). Here is my gruntfile.js // Generated on 2014-04-03 using generator-angular 0.8.0 'use strict'; // # Globbing // for performance reasons we're only matching one level down: // 'test/spec/{,*/}*.js' // use this if you want to recursively match all subfolders: // 'test/spec/**/*.js' module.exports = function (grunt) { // Load grunt tasks automatically require('load-grunt-tasks')(grunt); // Time how long tasks take. Can help when optimizing build times require(

Show image immediately after upload in sailsjs

送分小仙女□ 提交于 2019-12-04 14:22:37
I have form with upload field. After searching for a while, I just put uploaded files to folder ./assets/posts and it worked correctly. In my app, when submit done, it should be reload current url and show new uploaded image. But it didn't. My sails app use linker to manage assets. So after 3 or 4 times I try to reload the page, image is showed. How to show image immediately when I submit done? Thanks a lot! bredikhin Sails uses assets folder to store mainly the assets that are supposed to be precompiled and/or published, e.g. scripts, styles and minor images (icons, etc.). For images it means