Tag: gruntjs

找不到使用grunt的任务

我正在尝试在grunt中使用多个任务,其中一个正在部分工作,另一个则是not found task 。 这个问题是基于这个 ,我使用相同的gruntfile.js和相同的结构,这是这样的: ├── Gruntfile.js └── grunt ├── config │ ├── conf_sass.js │ └── conf_home.js └── register ├── reg_sass.js └── reg_home.js 有了这个相应的文件: conf_sass.js module.exports = function(grunt) { grunt.config.set('sass', { sass: { options: { style:'expanded', compass: true }, files: { 'src/css/app.css' : 'src/sass/app.scss' } }, cssmin: { options: { shorthandCompacting: false, roundingPrecision: -1 […]

从另一个任务访问Grunt当前任务

比方说,我有一个任务, myCustomTask被其他任务调用, quick 。 grunt.registerTask('myCustomTask', function(){ if(this.nameArgs === 'quick'){ console.log('ignoring task…'); return; }else{ grunt.task.run('my-custom-task'); } }); 我希望myCustomTask能够grunt quick地被忽略, 而不会将它从quick任务中移除。 grunt.registerTask('quick', [ 'task1', 'task2', 'myCustomTask' ]); 我希望this.nameArgs === 'quick'会触发当任务正在grunt quick跑,但它跳过,并达到其他块。 换句话说,第一个条件只有当我们使用this.nameArgs === 'myCustomTask' 我怎样才能瞄准任何一个任务,目前正在调用我们的自定义任务,所以我可以告诉它忽略它?

如何使用webpack从npm依赖关系编译.less文件?

我正在使用npm模块elemental ,它包含一个/less文件夹以及所有相关样式的反应UI。 我目前正在试图用less-loader来做到这一点: /tasks/config/webpack.js : 'use strict'; let path = require('path'); let ExtractTextPlugin = require('extract-text-webpack-plugin'); module.exports = function(grunt) { grunt.config.set('webpack', { client: { entry: { app: `${process.cwd()}/src/app.jsx`, }, output: { filename: '[name].js', chunkFilename: '[id].js', path: `${process.cwd()}/dist`, }, module: { loaders: [ { test: /\.jsx?$/, exclude: /(node_modules|bower_components|dist)/, loader: 'babel', query: { presets: ['react', 'es2015'], }, }, […]

jscs错误:validateLineBreaks:在filename.js无效换行符

在grunt-jscs它为base/index.js文件提供以下错误。 Running "jscs:src" (jscs) task validateLineBreaks: Invalid line break at api/v1/base/index.js : 1 |var errors = require('restify-errors'); ———————————————–^ 2 |function Base(Model) { 在我删除var errors = require('restify-errors'); 这一行,它开始给出下面的错误 Running "jscs:src" (jscs) task validateLineBreaks: Invalid line break at api/v1/base/index.js : 1 |function Base(Model) { ——————————^ 如何解决这个问题? find解决方法 :创build新文件并将所有内容复制到该文件中解决问题。 还想知道为什么发生这种情况的具体原因?

咕噜不能find指南针命令。 为什么不?

我正在尝试在CentOS 7上使用grunt和yeoman来设置node.js服务器,但是我收到一个错误,指出无法findcompass命令。 我读了另一篇关于类似错误的文章 ,但另一篇文章假设你在rails上使用ruby,而我并不这样做。 另外, 我正在testing的方法来自于本教程 ,当我在教程中指出要inputgrunt serve.时,事情就停止了grunt serve. 我已经做了几个补充教程,以逐一解决错误消息,但目前关于指南针的错误似乎没有谷歌答案。 我需要采取哪些具体步骤才能find并使用指南针? 这里是目前的错误导致grunt serve失败: Warning: Running "compass:server" (compass) task Warning: Command failed: /bin/sh -c compass –version /bin/sh: compass: command not found Use –force to continue. Aborted due to warnings. 这是导致这个问题的一系列命令: 首先,我以root身份执行了以下安装命令: yum install -y nodejs yum clean all && yum update yum install -y gcc-c++ openssl-devel […]

我怎样才能得到凉亭和咕噜咕噜添加angular-bootstrap用户界面依赖?

我正在学习node.js,并尝试使用自动化工具来pipe理AngularJS应用程序。 为此,我在centos 7 devbox中安装了nodejs,grunt,yeoman和bower,并正在试验我在新环境中创build的AngularJS应用程序。 我怎样才能得到凉亭添加angular-bootstrap ui依赖于我在这个环境中构build的AngularJS应用程序? 在我的应用程序中的bower.json和Gruntfile.js都是自动生成的,所以我毫不犹豫地编辑它们,没有一些指导。 我曾经试过的是什么: 到目前为止,我浏览到/path/to/workspace/client并键入bower install angular-bootstrap 。 该命令成功运行。 但是,在应用程序的index.html ,bower生成的依赖关系列表不包含angular-bootstrap ui依赖关系,即使在编辑器中closures了index.html之后,键入Ctrl-C来停止服务器,然后键入grunt serve来启动服务器再次在编辑器中重新加载index.html 。 index.html的bower生成的依赖项列表如下所示: <!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <base href="/" /> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <!– Place favicon.ico and apple-touch-icon.png in the root directory –> <!– build:css(.) styles/vendor.css –> <!– bower:css –> <!– endbower –> […]

在Grunt中显示输出为命令运行?

在这里,我没有输出,命令永远运行: grunt.registerTask('serve', function () { var done = this.async(); grunt.util.spawn({ cmd: 'jekyll', args: ['serve'], stdio: 'inherit' }, function (err, res, exit_code) { res.stdout && console.info(res.stdout); exit_code && console.error(res.stderr); done(err); }); }); 我想输出(和命令运行,直到错误或中断)。

npm节点模块中的对等关系问题

我已经遇到了一些问题,在我的项目安装grunt相关的节点模块依赖关系, 我想用一个命令安装选定的依赖关系,所以我在下面使用, npm install grunt grunt-contrib-jshint grunt-cli grunt-contrib-watch grunt-exec grunt-contrib-symlink grunt-contrib-clean grunt-contrib-copy grunt-text-replace grunt-git –save-dev 有错误,像“grunt-exec@0.4.6需要grunt@~0.4同行,但没有安装。 所以根据谷歌的反馈,发现我们可以像下面的修复一样对依赖版本进行硬编码, npm install grunt@~0.4 grunt-contrib-jshint grunt-cli grunt-contrib-watch grunt-exec grunt-contrib-symlink grunt-contrib-clean grunt-contrib-copy grunt-text-replace grunt-git –save-dev 它已暂时解决了这个问题,但现在我得到一个错误,像“grunt-git@1.0.0需要grunt@~1.0.1同行,但没有安装。 所以看起来,咕噜插件需要不同版本的相同的依赖 – 咕噜(在我的情况)。 逐个安装插件而不是集群也不能解决问题

找不到模块“npmlog” – 窗口

运行Windows 7企业。 如果我运行npm安装,我得到: Error: Cannot find module 'npmlog' at Function.Module._resolveFilename (module. at Function.Module._load (module.js:286:25) at Module.require (module.js:365:17) at require (module.js:384:17) at \\networkdrive\user\home\AppData\npm\node_modules\npm\bin\npm-cli.js:20:13 at Object.<anonymous> (\\networkdrive\user\home\AppDate\npm\node_modules\npm\bin\npm-cli.js76:3) at Module._compile (module.js:434:26) at Object.Module._extensions..js (module.js: at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) 节点居住在这里:H:\ tools \ node npm在这里:H:\ tools \ node \ node_modules \ npm 此外,如果我运行“咕噜”我得到“'咕噜'不被识别为内部或外部命令可操作的程序或batch file”,但如果我运行eclipse maven运行grunt命令,一切正常。 我是否需要添加任何path到我的环境variables? 我只能编辑访问USERvariables。

茉莉间谍document.execCommand不被调用

我写这样的testing describe('execCommand', function () { it('should call document.execCommand', function () { spyOn(document, 'execCommand').and.callThrough(); expect(document.execCommand).toHaveBeenCalledWith('foreColor', false, 'red'); document.execCommand('foreColor', false, 'red'); }); }); 但它失败Expected spy execCommand to have been called with [ 'foreColor', false, 'red' ] but it was never called. 我不知道为什么 请帮忙。 注意:我使用grunt-contrib-jasmine 0.9.2来运行它