gruntjs

Speed up sync latency between host and guest on Vagrant (NFS sync folders)

牧云@^-^@ 提交于 2019-12-21 01:18:20
问题 I'm using vagrant to run a wordpress dev environment on my local machine, have setup nfs as the default file-sharing mechanism (I'm on a mac). Overall performance is really good except for one thing: sync latency. I have set up grunt watchers on the guest to recompile css / javascript as well as livereload the page on every file change. However when I save a file on the host: it takes between 1 and 10 second before syncing on the guest. I'd like to be able to hit save on the host, and see

How do I “pull-out” only the dozen icons I actually use?

做~自己de王妃 提交于 2019-12-21 01:09:09
问题 I have an angular project that is built using grunt which uses maybe a dozen icons from font-awesome. Currently, I'm including and thus distributing the entire font-awesome library. Is there a way to "pull-out" only the icons I actually use (preferably as part of the build process)? I've seen the icomoon app, and that seems to give me the result I want, but it's a manual process to update when icon usage changes. 回答1: First use Font-Awesome-SVG-PNG to get individual SVG files for each Font

How do I “pull-out” only the dozen icons I actually use?

这一生的挚爱 提交于 2019-12-21 01:08:11
问题 I have an angular project that is built using grunt which uses maybe a dozen icons from font-awesome. Currently, I'm including and thus distributing the entire font-awesome library. Is there a way to "pull-out" only the icons I actually use (preferably as part of the build process)? I've seen the icomoon app, and that seems to give me the result I want, but it's a manual process to update when icon usage changes. 回答1: First use Font-Awesome-SVG-PNG to get individual SVG files for each Font

Execute PowerShell Script from Grunt

亡梦爱人 提交于 2019-12-21 00:24:12
问题 I have a PowerShell script (myScript.ps1) that I need to run as part of my build process. I'm using Grunt to build my code. I cannot figure out how to run this script from Grunt. Does anyone know how to run a PowerShell script from Grunt such that the next task won't run until the PowerShell script has completed? Thank you! 回答1: You could give a try to grunt-shell Install npm install --save-dev grunt-shell Load grunt.loadNpmTasks('grunt-shell'); Configure grunt.initConfig({ shell: { ps: {

grunt watch task block the command line

五迷三道 提交于 2019-12-20 18:31:03
问题 I'm new to grunt, still learning, so I came up to a very strange problem. When I run "watch" task, my command line becomes blocked, so basically I cant do anything on it. Bare in mind that the task is completed with success. This is my command line output: C:\server\css-test>grunt w Running "watch" task Waiting...OK >> File "compass-examples-master\02\sass\screen.scss" changed. Running "compass" (compass) task unchanged compass-examples-master/02/sass/ie.scss unchanged compass-examples-master

grunt server can't be connected <gruntjs>

自古美人都是妖i 提交于 2019-12-20 18:29:53
问题 module.exports = function(grunt) { // Project configuration. grunt.initConfig({ server: { port: 8888, base: '.' } }); }; C:\Program Files\nodejs\test\grunt> C:\Program Files\nodejs\test\grunt>grunt server Running "server" task Starting static web server on port 8888. Done, without errors. but can't connected by input [http://127.0.0.1:8888][1] in browsers ! jiong~ How about to fix this problem in windows or unix ? 回答1: In grunt 0.4 combined with grunt-contrib-connect you can run a long

Angular resource testing: $httpBackend.flush() cause Unexpected request

旧城冷巷雨未停 提交于 2019-12-20 14:12:37
问题 I want to test angularjs resource. 'use strict'; /** * AddressService provides functionality to use address resource in easy way. * * This is an example usage of method: * * `get`: * var a = AddressService.get({id: '1'}, function (data) { // Work here with your resource } ); * */ App.factory('AddressService', function ($resource, $rootScope) { var url = [ $rootScope.GLOBALS.API_PATH, $rootScope.GLOBALS.API_VERSION, 'models/address/:id' ].join('/'), actions = { 'get': { method: 'GET', params:

Registering Grunt tasks whose code is located in external JavaScript files

不想你离开。 提交于 2019-12-20 11:55:28
问题 I've written a function which I'd like to use as a Grunt task. I can do this by adding this to the Gruntfile: grunt.registerTask('foo', function () { // code here }); However, it makes more sense to keep the function code in a separate file. I plan to define a bunch of these custom tasks and I don't want to bloat the Gruntfile. I'm not sure what the preferred way of registering such tasks is. I have found this to work: grunt.registerTask('foo', function () { require('./path/to/foo.js')(grunt)

How do I remove some javascript during grunt-usemin compilation

南笙酒味 提交于 2019-12-20 10:35:18
问题 I have code that makes it easy and fast to write/test code, that code does not belong in my production code (mostly it mocks out the server so I only need the grunt server). Two parts to this, one is how to I remove parts of a script angular.module('nglaborcallApp', [ 'ngCookies', 'ngResource', 'ngSanitize', 'ngRoute', 'server_mocks', // Don't want this line in the production build 'dialogs' ] and then a section of index.html that needs to go away <!-- build:js({.tmp,app}) scripts/mocks/mocks

Nodemon-like task in Grunt : execute node process and watch

[亡魂溺海] 提交于 2019-12-20 10:33:49
问题 I feel like I'm missing something. Here is what I want to achieve : Having a grunt task that executes my server.js and runs watch task in parallel. It feels to me that this is precisely one of the tasks grunt was designed for but I can't achieve this configuration. Among others, I have read this : Running Node app through Grunt but I still can't make it. Here is my Gruntfile.js : module.exports = function(grunt) { // Project configuration. grunt.initConfig({ watch: { scripts: { files: ['*.js'