gruntjs

A solution for two-binding between angular and a style sheet

回眸只為那壹抹淺笑 提交于 2019-12-03 07:56:36
I know this sounds silly but I'm writing a wysiwyg editor that allows Designers to create style guides. I've become very fascinated with 2 way binding in angular and was curious if it was possible to two-way bind between a css sheet and a ng-model input field. Currently, I'm making a dynamic style guide that allows a designer to colorpick a primary, secondary colors of a page. These color will change the entire theme of the site uniformly and it would be awesome to do this from the stylesheet itself. HTML <input type="text" ng-model="color.primary" /> <button class="btn primary-color" /> CSS

Grunt serve + PHP?

情到浓时终转凉″ 提交于 2019-12-03 07:37:03
I'm starting my first project with yo + grunt + angular.js. I have a service which needs to read some data from my server; I built it using angular $http service. I've also built a RESTful web service (implemented in PHP, but it could be Java, C, Perl, ..., it doesn't matter) which exposes an API to get the data. The server from which grunt serves my ng-app is currently (and probably will ever be) the same from where the PHP web service is run (by apache). I wonder if this is an acceptable architecture... I end up having two distinct servers (grunt and apache) on the same server... More, I

Execute PowerShell Script from Grunt

让人想犯罪 __ 提交于 2019-12-03 07:25:24
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! 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: { options: { stdout: true }, command: 'powershell myScript.ps1' } } }); Use grunt shell:ps 来源: https:/

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

落花浮王杯 提交于 2019-12-03 07:13:56
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. First use Font-Awesome-SVG-PNG to get individual SVG files for each Font Awesome icon. font-awesome-svg-png --color black --sizes 128 --no-png Then using grunt-webfont , combine the

Module for Pretty Printing HTML?

余生长醉 提交于 2019-12-03 07:10:21
I'm working on a grunt build file which hits a URL and writes the output to a static HTML file. The url I'm hitting has compressed HTML and I'd like to pretty print it before writing to the static file. Are there any good modules for doing this? I've looked around and it seems like Max Ogden's html prettyprinter is my closest option (https://github.com/maxogden/commonjs-html-prettyprinter). Maybe if I combine it with the grunt-shell task or something? Really I'd prefer to just require a module in grunt and say pretty(my-file.html) and then write that using fs but so far that is proving elusive

Bower, Grunt & zsh: command not found:

a 夏天 提交于 2019-12-03 07:10:11
问题 I have installed Grunt & Bower & I'm using ZSH. when I type bower --help or grunt anything I get zsh: command not found: bower or zsh: command not found: grunt how can I fix this? 回答1: Add /usr/local/share/npm/bin/ to your $PATH environment 回答2: I couldn't get the above to work. Problem was that I had just reinstalled my Mac and forgotten to re-install grunt. You can test that grunt is actually installed and working properly outside of zshell by going back to bash with bash -l and running

How can I skip a grunt task if a directory is empty

ぐ巨炮叔叔 提交于 2019-12-03 07:03:49
I'm using grunt-contrib's concat and uglify modules to process some javascript. Currently if src/js/ is empty, they will still create an (empty) concat'd file, along with the minified version and a source map. I want to task to detect if the src/js/ folder is empty before proceeding, and if it is, then the task should skip (not fail). Any ideas how to do this? The solution may not be the prettiest, but could give you an idea. You'll need to run something like npm install --save-dev glob first. This is based on part of the Milkshake project you mentioned. grunt.registerTask('build_js', function

How to exclude certain requireJS files from uglifying/optimizing

六月ゝ 毕业季﹏ 提交于 2019-12-03 06:42:08
问题 I have a working requirejs project that is using grunt for building and deployment. If using no optimization at all, the build is working without problems and I get one big js file to deploy it on production. The problem I have is, that I have some external frameworks (like angularJS) where I already have a minimized/optimized version of it and don't want to optimize it again. Currently without optimization I include the minified version of this framework via a seperate path config in my

How to Debug Grunt Mocha Task?

穿精又带淫゛_ 提交于 2019-12-03 06:41:20
I am using WebStorm to run a grunt task. The debugger successfully stops at the breakpoint in the Gruntfile.js file, but not in my task file. In the Gruntfile.js I register a task like this: grunt.initConfig({ ... configuration ... }); grunt.registerTask('myTask', ['mocha:myTask']); When I set a breakpoint in the corresponding js file for the test 'myTask' it doesn't stop. How can I debug also the grunt tests? --- UPDATE --------------------------------------- so i tried all of your possible solutions, but it does not solve my problem! I am able to debug the grunt script itself, this is where

List grunt.js tasks

こ雲淡風輕ζ 提交于 2019-12-03 06:26:05
问题 I'm trying to work out how to print a list of all available grunt tasks. With rake it would be: $ rake -T What's the equivalent for grunt? e.g. $ grunt -T concat jasmine minify 回答1: grunt --help lists available tasks. 回答2: Workaround for the list in sh/bash in case you need to trigger something and can't modify the original code: grunt -h --no-color | sed -n '/^Available tasks/,/^$/ {s/^ *\([^ ]\+\) [^ ]\+.*$/\1/p}' 来源: https://stackoverflow.com/questions/15004624/list-grunt-js-tasks