Tag: gruntjs

grunt-sass缩小的CSS Sourcemap不正确

所以我用grunt-sass来编译我的sass,但是我遇到了一个问题。 sass: { options: { outputStyle: 'compressed', sourceMap: true }, dist: { files: { '<%= pkg.dir.css %>/styles.css': '<%= pkg.dir.sass %>/styles.scss' } } }, 一切都很好,但创build的源代码将CSS指向完全不正确的位置。 如果css没有被缩小,这个工作就很好。 有没有人遇到过这个问题,或者对这个问题有什么想法?

提示input使用grunt-shell插件

我有一个脚本,我试图用grunt-shell插件运行。 这个脚本使用read -p "enter foo" bar提示input。 当我运行它时,我得到一个正确接受我的input的光标,但我没有看到“inputfoo”。 我尝试修改grunt-shellconfiguration,将err,stderr和stdout转储到控制台,但是一旦命令完成,它们全都变空。 阅读手册页说-p标志“只有当input来自terminal时,才显示提示”,这似乎是我的问题,因为节点正在调用提示符,但读取命令正在我的执行terminal,我正在input一个terminal,所以为什么不这样做? 所以,我的问题是,有没有什么办法提示用户从grunt-shell插件input? 另外,作为一个PS,是的,我知道只要回应提示并处理下面的input就很容易了,但是要承认这是事物的原理。

如何解决致命错误使用imagemin插件时写EOF

新的咕噜,使用grunt-contrib-imagemin来优化我的图像。 默认设置与PNG很好地工作并且保存了很多。 但是jpegs几乎没有任何节省。 我正在尝试使用一个imagemin插件来处理jepg压缩。 我得到了mozjepg工作很容易使用这个gruntfile – http://pastebin.com/z3eL3uZU[1] 问题是,mozjepg仍然几乎没有保存从图片的任何kb。 所以我试图find一个真正压缩jpegs的imagemin pligin。我find了这两个,想尝试但不能让他们工作。 第一个是https://www.npmjs.com/package/imagemin-jpeg-recompress[2] ,我的gruntfile看起来像这样 – http://pastebin.com/7cXTLYe7[3] – CLI错误是这个 C:\Users\bmildren\Desktop\Sites\grunt-test>grunt imagemin:jpg Running "imagemin:jpg" (imagemin) task Fatal error: write EOF C:\Users\bmildren\Desktop\Sites\grunt-test> 同样的事情基本上也发生在这个imagemin插件https://www.npmjs.com/package/imagemin-jpegoptim[4]任何人都知道如何解决这个问题?

无法在yeomanangular度生成的webapp中生成“dist”文件夹

我无法生成使用yeomanangular生成器生成和生成的Web应用程序中的dist文件夹。 我正在粘贴冗长的构build。 请检查这是否有帮助。 pdc1-f3t18r1:ShippingSolution administrator$ grunt –verbose build Initializing Command-line options: –verbose Reading "Gruntfile.js" Gruntfile…OK Registering Gruntfile tasks. Registering "grunt-autoprefixer" local Npm module tasks. Reading /Users/administrator/Desktop/CiscoShipping/ShippingSolution/node_modules/grunt-autoprefixer/package.json…OK Parsing /Users/administrator/Desktop/CiscoShipping/ShippingSolution/node_modules/grunt-autoprefixer/package.json…OK Loading "autoprefixer.js" tasks…OK + autoprefixer Registering "grunt-concurrent" local Npm module tasks. Reading /Users/administrator/Desktop/CiscoShipping/ShippingSolution/node_modules/grunt-concurrent/package.json…OK Parsing /Users/administrator/Desktop/CiscoShipping/ShippingSolution/node_modules/grunt-concurrent/package.json…OK Loading "concurrent.js" tasks…OK + concurrent Registering "grunt-contrib-clean" local Npm module tasks. Reading […]

在“devDependencies”和“peerDependencies”中指定node.js依赖项

我刚刚在grunt-contrib-clean package.json文件中发现,它依赖于grunt ,它在两个部分都有说明: devDependencies和peerDependencies , https : devDependencies master / package.json#L25-L34 : "devDependencies": { "grunt": "^0.4.5", "grunt-cli": "^0.1.13", "grunt-contrib-internal": "^0.4.10", "grunt-contrib-jshint": "^0.11.0", "grunt-contrib-nodeunit": "^0.4.1" }, "peerDependencies": { "grunt": ">=0.4.0" }, 这有任何意义吗? 特别是有不同的说法? 这是一个不被察觉的错误吗? 编辑:也发布了一个github的问题 。

如何将全局/公共variables添加到grunt-contrib-uglify输出

好的,所以我对Grunt和Node.js是新的。 我正在build立一个网站,并决定'main.js'文件变得太大了。 所以,我把它分开,现在我正在尝试使用Grunt将所有这些JS文件重新组合在一起。 我的问题是,我需要使所有这些JS文件中的所有function都可用的全局variables。 更具体地说,我们网站上的每个页面都通过body标签中的id来标识: <body id="home"> 这些JS文件中的许多包含if语句,这些语句确保某些函数只在加载了相应的页面时才运行。 例如: if (page == 'home') { var title = "Home Page" $('.page-title').text(title); } 注意pagevariables? 那个人是我需要提供给所有这些文件(grunt-contrib-uglify合并在一起之后)的人。 所以,我想我会分配一个新的“唯一”的variables名称,并使其全球。 我注意到, grunt-contrib-uglify在其文档中列出了一个' wrap '选项。 然而,没有例子给出如何使用它。 任何人都可以告诉我: – 如何使用'grunt-contrib-uglify'中的'wrap'选项 – 如果这是我正在尝试做的正确的grunt插件? 我有一个想法(作为最后的手段)是创build一个before.js和after.js ,把我想要包装其他文件的开始和结束(分别)。 但是,我认为“包装”选项是我需要的,是的? 更新:这是一个链接到我的“合并”JS文件: main.js 并链接到我的Gruntfile: Gruntfile.js

没有find突然的Grunt任务

我被这个难住了 我现在通过CLI和WebStorm使用Grunt一段时间。 今天我正在通过WebStorm Grunt面板运行一些手动Grunt任务,神奇的是,似乎发生了一些事情,我无法再在这个项目上运行任何任务(无论是通过WebStorm还是命令行)。 我已经尝试了一切,从重新安装grunt / grunt-cli,重新启动我的电脑,缩短grunt文件无济于事。 下面是一个带有问题输出的超级缩写Gruntfile.js。 任何想法可能发生的事情,以及如何恢复我的build设环境,非常感谢! Carlos@XPS8500 ~/git/Test $ cat Gruntfile.js 'use strict'; module.exports = function (grunt) { require('load-grunt-tasks')(grunt); grunt.initConfig({ copy: { dist: { files: [ { expand: true, cwd: '.', src: 'package.json', dest: 'package.xxx' } ] } } }); grunt.registerTask('test', 'Test', function(){ grunt.task.run('copy:dist'); }); }; Carlos@XPS8500 ~/git/Test $ grunt –verbose test […]

停止Grunt Watch破解代码错误

我正在使用grunt-contrib-watch任务。 我想知道是否是阻止观察者破解代码错误的一种方法? 这是为了加快我的工作stream程,因为重启构build和观察任务需要21秒。

grunt-contrib-connect代理给出错误500.如何debugging?

我想代理http:// localhost:9000 / images和http:// localhost:9000 / rest到https:// remotehost / images和https:// remotehost / rest,但是我得到两个错误500。 我究竟做错了什么? 如何debugging呢? 这是我的configuration: connect: { options: { port: 9000, // Change this to '0.0.0.0' to access the server from outside. hostname: 'localhost', livereload: 35729 }, proxies: [ { context: '/images', host: remotehost, port: 443, https: true, changeOrigin: true, xforward: false, rejectUnauthorized: false […]

Grunt监视任务直到第一个输出到控制台才开始

我的任务configuration工作正常,但我有一个恼人的问题,监视任务不开始监视,除非我刷新页面或添加一行控制台输出。 所以通常我应该得到: Running "watch" task Waiting… 但是直到输出到控制台,我才明白。 这是一个错误? 我的configuration是: module.exports = function(grunt) { grunt.initConfig({ concat: { options: { separator: '\n\n' }, dev: { src: ['ng_app/app.js', 'ng_app/**/*.js'], dest: 'public/js/app.js' } }, less: { dev: { files: [ { expand: true, cwd: 'styles', src: ['*.less', '!mixins.less', '!var.less'], dest: 'public/css/', ext: '.css' }, { expand: true, cwd: 'styles/views', […]