Tag: gruntjs

是否有可能使用gruntjs和/或lesscss将所有的CSS放在一行?

所有的.js和.less文件都是在我的项目中用gruntjs(内置.js支持)和grunt-less-contrib插件在.less文件中完成的。 一时间,lesscss以一种每行定义的方式压缩css,比如下面的.less文件: div,span,textarea,input { margin:0; } 它会输出: div, span, textarea, input { margin:0; } 我想压缩所有的CSS到一行,对于这个例子,它应该是这样的: div,span,textarea,input{margin:0;}…other styles… 可能吗? 任何build议都会有所帮助,我不确定这是一个直接的问题。 也许可以在构buildbuild.css之后添加一个任务,然后执行串联?

如何在PHPStorm(WebStorm)中debugginggrunt

在PHP Storm中有一个关于debugginggrunt(例如事件监听器函数)的好主意。 在风暴中有Node.js的支持,但我不知道如何configurationdebugging设置,如果我想debugging一个咕噜的任务,例如当一个文件改变和监视任务发出它。

在向dev-dependencies添加grunt时未能parsingjson

我有一个简单的package.json,并试图添加grunt到我的项目。 我已经做了很多次,但从未遇到过这个问题 我的package.json : { "name": "express-todo", "main": "server.js", "dependencies": { "body-parser": "^1.0.2", "express": "^4.1.1", "jade": "^1.3.1", "mongoose": "^3.8.8", "nodemon": "^1.0.17", "request": "^2.34.0" } } 然后从命令行我得到的错误: $ npm install grunt –save-dev npm WARN package.json express-todo@ No repository field. npm http GET https://registry.npmjs.org/grunt npm http 304 https://registry.npmjs.org/grunt npm ERR! Failed to parse json npm ERR! Unexpected […]

Karma public api缺lessconfigFile选项

gulp-karmabuild议像这样的外部configuration文件: module.exports = { basePath: '', singleRun: true }; 我想要一个像这样的外部configuration文件(grunt-karma风格): module.exports = function(config) { config.set({ basePath: '', singleRun: true }); }; 如何使用proper config file与业力API。 细节: 我正在使用gulp-karma,正如前面提到的那样,我必须自己实施。 Karma API非常简单: var server = require('karma').server; server.start(config, done); configvariables是模糊的。 这是一个简单的configuration对象: var config = { basePath: '', singleRun: true // … } 让我们来看看grunt-karma: 示例grunt-karmaconfiguration: karma: { unit: { configFile: 'karma.conf.js' […]

转发咕噜连接到不同的url

我使用grunt连接livereload为我的开发环境。 我想能够调用服务器下的生产API。 要做到这一点,我需要指挥任何来电 http://localhost:9000/server 至 http://www.production-server.com/server 这对我有好处,因为有时我想在开发模式下对生产服务器进行testing。 这是我目前的连接configuration(由Yeoman生成): connect: { options: { port: 9000, // Change this to '0.0.0.0' to access the server from outside. hostname: 'localhost', livereload: 35729 }, livereload: { options: { open: true, middleware: function(connect, options, middlewares) { return [ connect.static('.tmp'), connect().use( '/bower_components', connect.static('./bower_components') ), connect.static(appConfig.app) ]; } } }, test: { […]

GruntJS + contrib-coffee:编译但保持文件夹结构

我用grunt-contrib-coffee使用GruntJS 。 这很好用! 随着Watch插件的帮助,它甚至更好。 但是我怀疑: 我有两个文件夹,其中一个用我的coffeescript文件,另一个用我的(编译的)js文件。 看起来像这样 root_folder |— public |— libs |— ppalmeida <= here are my .js compiled files from src_client coffeescripts |— controllers |— core |— Main.js |— models |— src_client <= here are my .coffee files |— controllers |— core |— Main.coffee |— models 当我使用coffee –output –compile命令构build时,文件夹结构保持不变:Coffeescript cli编译“core”文件夹并在Main.js中。 但是当我运行GruntJS时,它将所有文件放在同一个文件夹(ppalmeida)中。 所以控制器,核心,模型文件被扔在同一个文件夹,女巫我不想要的。 这是我的glob_to_multipleconfiguration: […]

grunt-contrib-copy死于EPERM操作不允许“C:\ Documents and Settings”

我正在尝试使用grunt-contrib-copy来运行一个简单的grunt任务,但它在到达复制任务时立即死亡,并带有以下消息: 运行“复制:主”(复制)任务 警告:EPERM,不允许操作'C:\ Documents and Settings'使用 – 强制继续 由于警告而中止 我在跑步: Windows 7 64位(所以C:\Documents and Settings不存在) 节点0.10.28(安装在C:\nodejs ) npm 1.4.9 grunt-cli 0.1.13 咕噜0.4.5 grunt-contrib-copy 0.5.0 我已经在C:\nodejs和我的项目文件夹( C:\Users\myusername\Documents\Programming\myprojectname ,在那里没有空格或圆括号)上对“Documents and Settings”进行了全文search,但没有任何匹配。 我的copy任务定义是: copy: { main: { files: [ {expand: true, cwd: 'src/core', src: '/**', dest: 'src/chrome/'}, {expand: true, cwd: 'src/core', src: '/**', dest: 'src/firefox/'} ] } }, […]

我怎样才能重新安装grunt在yeoman项目?

我的Grunt安装发生了一些事情,我不知道它是什么。 我正在使用Yeoman脚手架我的应用程序,但今天我开始得到许多Grunt错误。 例如,当我运行Grunt Test时,我现在得到以下内容: Loading "autoprefixer.js" tasks…ERROR >> Error: Cannot find module 'base64-js' Loading "connect.js" tasks…ERROR >> Error: Cannot find module 'cookie-signature' Loading "imagemin.js" tasks…ERROR >> Error: Cannot find module './lib/js-yaml.js' Loading "jshint.js" tasks…ERROR >> Error: Cannot find module 'jshint' Loading "uglify.js" tasks…ERROR >> Error: Cannot find module './source-map/source-map-generator' Loading "cdnify.js" tasks…ERROR >> SyntaxError: /Users/Documents/Git/client/node_modules/grunt-google-cdn/node_modules/google-cdn/node_modules/cdnjs-cdn-data/external/cdnjs.json: […]

Grunt不会加载节点服务器

我的gruntfile.js是: 'use strict'; module.exports = function(grunt) { // Project Configuration grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), watch: { jade: { files: ['app/views/**'], options: { livereload: true, }, }, js: { files: ['gruntfile.js', 'server.js', 'app/**/*.js', 'public/js/**', 'test/**/*.js'], tasks: ['jshint'], options: { livereload: true, }, }, html: { files: ['public/views/**'], options: { livereload: true, }, }, css: { files: ['public/css/**'], […]

由于imagemin问题,Grunt构build失败,出了什么问题?

我正在尝试使用grunt build构build一个应用程序,我得到这个错误: # grunt build Running "clean:dist" (clean) task Running "wiredep:app" (wiredep) task Running "wiredep:sass" (wiredep) task Running "includeSource:dist" (includeSource) task File "dist/index.html" created. Running "useminPrepare:html" (useminPrepare) task Configuration changed for concat, uglify, cssmin Running "concurrent:dist" (concurrent) task >> Warning: There are more tasks than your concurrency limit. After this limit >> is reached no […]