Tag: gruntjs

我如何从一个咕task任务中运行一个咕噜任务?

我创build了一个新的grunt任务,在其中我想使用grunt-contrib-concat来连接几个文件。 我查看了文档,但是我没有发现任何暗示能够做到的事情。 这似乎是一个微不足道的用例,所以我可能只是在看什么。 更新1: 我也希望能够从我的自定义任务中configuration此任务。 例如,我在我的自定义任务中创build了一个文件列表。 有了这个列表之后,我想把它们传递给concat任务。 我怎样才能做到这一点? 我希望能够做到这样的事情。 grunt.task.run('concat', { src: ['file1','file2'], dest: 'out.js'}) 更新2: 为了达到我想要的,我必须手动configurationgrunt任务。 这是一个例子,显示我想要什么。 https://github.com/gruntjs/grunt-contrib/issues/118#issuecomment-8482130

Bootstrap中的Grunt依赖冲突

我已经从官方网站下载了Bootstrap源文件,并且在使用节点的npm安装项目时遇到依赖冲突。 我在我的机器上安装了grunt 0.4.3 ,但是一些引导依赖需要0.4.0和0.4.1 。 npm install -g grunt-cli命令执行时没有任何问题。 下面是执行npm install命令后得到的日志: npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer grunt-banner@0.2.1 wants grunt@~0.4.1 npm ERR! peerinvalid Peer grunt-contrib-clean@0.5.0 wants grunt@~0.4.0 npm ERR! peerinvalid Peer grunt-contrib-concat@0.3.0 wants grunt@~0.4.0 npm ERR! peerinvalid Peer grunt-contrib-connect@0.6.0 wants grunt@~0.4.0 npm ERR! peerinvalid […]

来自Webstorm的Gruntdebugging

它可能通过外部工具在WebStorm中运行咕噜的任务。 但是,是否可以利用外部工具进行debugging? 通过在WebStorm中运行grunt server或grunt test等任务,如果使用grunt等外部工具,debugging将变得更加容易。

如何忽略文件grunt uglify

背景 大约30分钟前我刚刚开始使用咕噜声。 所以请忍受我。 但是我有一个相当简单的脚本,它会查看我的js,然后将它压缩到一个文件中。 码 "use strict"; module.exports = function (grunt) { // load all grunt tasks require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: { options: { beautify: true, report: 'gzip' }, build: { src: ['docroot/js/*.js', 'docroot/components/pages/*.js', 'docroot/components/plugins/*.js'], dest: 'docroot/js/main.min.js' } }, watch: { options: { dateFormat: function(time) { grunt.log.writeln('The watch finished in ' + time + […]

如何使用grunt-contrib-livereload?

我试图使用grunt-contrib-livereload ,但似乎无法弄清楚。 自述文件似乎跳过了我需要解释的所有内容,然后以一个不适用的示例结束,当我尝试它时,似乎与文档没有直接关系。 我已经在博客文章或教程中find了更好的解释,但是一直没能find。 有人可以解释如何开始使用这个工具吗? 以下是基于自述文件的各种问题: 该文件说,livereload任务“必须通过已更改的文件列表”—但如何将它传递给这个文件列表? 这个例子似乎没有说明这一点。 贵宾是否通过了名单? 需要grunt-contrib-connect吗? 它做什么,我该如何使用它? 在尝试使用livereload之前,我需要学习连接吗? 自述文件提到中间件“必须是第一个插入的”—但插入什么之前,还有什么? 而且它是如何插入的? 我想我不明白我需要如何操作端口。 “所有在livereload端口上侦听的浏览器都将被重新加载”—但我怎么知道哪个浏览器正在侦听哪个端口? 在尝试使用livereload之前,是否需要了解有关端口的所有信息? (有关如何最好地了解这一点的任何build议?) 最后,在这个例子中,有一个与之前的任何文档都没有关系的folderMount函数。 那是什么,我需要吗? 我想我问是否有人可以请: 指向一个比当前自述更有效的教程; 解释自述文件中这些无法解释的部分,如果这些答案是我需要了解的插件; 或者提供一个function性的例子,说明它为什么起作用。

如何卸载npm包?

我用sudo npm install grunt ,我无法删除它。 我试过: $ sudo npm uninstall grunt 但它给WARN: npm WARN uninstall not installed in /home/kuba/projects/node_modules: "grunt-cli" 我也尝试RM,删除和取消链接。 和-g选项,它给: npm WARN uninstall not installed in /usr/lib/node_modules: "grunt" 但是我仍然可以从命令行调用grunt 。 编辑 : $ whereis grunt grunt: /usr/local/bin/grunt $ file /usr/local/bin/grunt /usr/local/bin/grunt: symbolic link to `../lib/node_modules/grunt/bin/grunt' $ ls /usr/local/lib/node_modules grunt jshint $ ls /usr/lib/node_modules […]

咕噜致命的错误:无法findYeoman当地的咕噜声

我安装了yeoman,并开始在官方文档中提供的例子。 我经历了build议的操作 yo webapp bower install underscore grunt 跑完咕噜之后,我有消息 grunt-cli: The grunt command line interface. (v0.1.9) Fatal error: Unable to find local grunt. If you're seeing this message, either a Gruntfile wasn't found or grunt hasn't been installed locally to your project. For more information about installing and configuring grunt, please see the Getting Started […]

升级到节点7后无法find模块“内部/ fs”

我们最近尝试升级到构build服务器上的节点v7.0.0,但在应用程序构build任务失败的“bower_concat”步骤中开始出现问题: Loading "bower-concat.js" tasks…ERROR Error: Cannot find module 'internal/fs' 我们已经安装了: node v7.0.0(通过yum “nodesource”存储库安装) npm 4.0.1 使用grunt (如果这是相关的) grunt-bower-concat 0.6.0 咕噜生成任务configuration: grunt.registerTask( 'build:prod', [ 'clean:prod', 'copy:prod', 'replace', 'bower_concat', 'ngtemplates', 'concat', 'uglify', 'cssmin', 'injector:prod', 'copy:cssfix', 'copy:dist', 'bowercopy:dist', 'bowercopy:fonts', 'template:setProdVersion' ] ); 而咕噜bower_concat任务: bower_concat: { all: { dest: '<%= app.build %>/bower.js', cssDest: '<%= app.build %>/bower.css', dependencies: { 'bootstrap': […]

如何根据相应文件的父文件夹名称使用Grunt重命名文件?

我有以下结构: src/ modules/ module1/ js/ main.js scss/ main.scss index.html module2/ js/ main.js scss/ main.scss index.html 我想运行一个咕task任务,将其复制到以下结构中: dev/ js/ module1.js module2.js css/ module1.css module2.css module1.html module2.html 有没有办法做到这一点与现有的咕噜插件? 如果没有,我怎么能做到这一点?

如何在Visual Studio 2015中保存.sass文件

在Visual Studio 2015中如何获得完整的sass(即scss)预编译器环境? 对于这个问题,这是一个兄弟姐妹的问题。