Tag: gruntjs

grunt ngtemplates任务100%cpu

咕噜任务ngtemplates运行无限期(近一个小时,没有完成)与100%的CPU利用率。 如果我评论这个任务,那么构build完成。 然后在ngtemplates中创build任务,并在另一台机器上完成OK。 任何想法/线索都非常感谢。 节点版本:0.10.29 grunt-cli:v0.1.13 grunt:v0.4.5 ngtemplates: { app: { cwd: '<%= yeoman.app %>', src: ['views/{,*/}*.html', 'views/inbox/{,*/}*.html' , 'scripts/directives/*.html'], dest: 'scripts/templates.js', options: { usemin: 'scripts/scripts.js', // <~~ This came from the <!– build:js –> block htmlmin: { collapseBooleanAttributes: true, collapseWhitespace: true, removeAttributeQuotes: true, removeComments: true, // Only if you don't use comment directives! removeEmptyAttributes: […]

Grunt突然停止工作

试着在我的项目上运行Grunt build和Grunt watch,我遇到了以下错误: Fatal Error: Unable to find local grunt. 我确保文件没有被删除。 我试着重新安装Node和Grunt。 文件在那里,重新安装不起作用。 我已经包含了debugging文件以供参考。 有谁知道这个问题可能是什么? 0 info it worked if it ends with ok 1 verbose cli [ 'E:\\Program Files\\nodejs\\\\node.exe', 1 verbose cli 'E:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install' ] 2 info using npm@1.3.24 3 info using node@v0.10.25 4 verbose node symlink E:\Program Files\nodejs\\node.exe 5 […]

Grunt将angular度ui路由器模板连接成一个文件

我有一个有150个文件的angular-ui-router项目。 我想写一个咕噜的任务,把它们全部合并成一个index.html像这样: <script type="text/ng-template" id="path-to-file-1.html"> Content of file-1.html here </script> <script type="text/ng-template" id="path-to-file-2.html"> Content of file-2.html here </script> <script type="text/ng-template" id="path-to-file-3.html"> Content of file-3.html here </script> … 我正在考虑使用https://github.com/outaTiME/grunt-replace,但我想尽可能做到这一点。 我目前的想法: 的index.html <body> @@path-to-file-1.html @@path-to-file-2.html @@path-to-file-3.html </body> gruntfile.js replace: { dist: { options: { patterns: [ { match: 'path-to-file-1.html', replacement: '<%= grunt.file.read("path/to/file-1.html.html") %>' }, { match: 'path-to-file-2.html', […]

Drupal 7. Bootstrap和Grunt

我试图使用Bootstrap和Grunt作为编译器。 把所有东西都安装到我的自定义主题中。 我通过npm install下载了所有的依赖关系,然后添加了一个node_modules文件夹。 现在一切都很好,当使用咕噜编译等,我的问题在于,当你去Drupal我得到这个警告… Warning:opendir(sites / all / themes / custom / theme / vendor / bootstrap / node_modules / grunt-contrib-jade / node_modules / jade / node_modules / transformers / node_modules / uglify -js / node_modules / optimist / node_modules / wordwrap,sites / all / themes / custom / lmax_hk / vendor / bootstrap […]

如何configurationGrunt serve / livereload来组合胡子模板

我正在使用Yeoman模板开发一个静态网站。 grunt serve很好地与自动重载插件。 对于重复的元素,我开始使用{{mustache}}部分,它就像一个爆炸。 现在我想要自动重新装入我的页面,所以我可以在编辑一个胡须文件(主文件或部分文件)时查看结果页面。 我发现了一个咕噜噜的任务 ,但拼接在一起躲避我。 我的configuration如下所示: grunt.initConfig({ sass: { dev: { src: ['src/sass/*.sass'], dest: 'dest/css/index.css', }, }, watch: { sass: { // We watch and compile sass files as normal but don't live reload here files: ['src/sass/*.sass'], tasks: ['sass'] }, mustache: { files: '**/*.mustache', tasks: ['mustache_render'], options: { interrupt: true }, }, livereload: […]

没有findzsh:命令:grunt-init

我是gruntjs的新手,并试图让grunt-init模板启动并运行,但是我经常得到这个错误: zsh: command not found: grunt-init 当我运行安装它显示我所有这一切,所以它似乎是安装好 → npm install -g grunt-init /Users/jsturgess/npm-global/bin/grunt-init -> /Users/jsturgess/npm-global/lib/node_modules/grunt-init/bin/grunt-init grunt-init@0.3.2 /Users/jsturgess/npm-global/lib/node_modules/grunt-init ├── semver@1.0.14 ├── colors@0.6.2 ├── async@0.2.10 ├── hooker@0.2.3 ├── lodash@2.4.1 ├── prompt@0.1.12 (async@0.1.22, pkginfo@0.3.0, winston@0.5.11) └── grunt@0.4.5 (which@1.0.9, dateformat@1.0.2-1.2.3, eventemitter2@0.4.14, getobject@0.1.0, rimraf@2.2.8, async@0.1.22, grunt-legacy-util@0.2.0, exit@0.1.2, nopt@1.0.10, lodash@0.9.2, coffee-script@1.3.3, underscore.string@2.2.1, glob@3.1.21, iconv-lite@0.2.11, grunt-legacy-log@0.1.1, js-yaml@2.0.5, minimatch@0.2.14, findup-sync@0.1.3) 我已经按照grunt-init的安装说明创build了~/.grunt-init/目录,并通过命令给出了jquery模板 git clone […]

Grunt:找不到任务“grunt-bower”

我想通过使用npm install grunt-bower –save来为我的咕噜声安装包grunt-bower 。 安装之后,我在node_modules里看到了包grunt-bower 。 这是我的gruntfile.js : module.exports = function(grunt) { grunt.initConfig({ bower: { dev: { dest: 'public', js_dest: 'public/javascripts', css_dest: 'public/stylesheets' } }, watch: { source: { files: ['sass/**/*.scss', 'views/**/*.jade'], tasks: ['sass'], options: { livereload: true, // needed to run LiveReload } } } }); grunt.loadNpmTasks('grunt-bower'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ['grunt-bower']); }; 我已经在官方网页上注册: grunt.loadNpmTasks('grunt-bower'); […]

用grunt生成模板 – 寻找任务

我有一个包含以下内容的HTML文件: <html> <body> <span>{{ secret }}</span> </body> </html> 我正在寻找一个可以采取这个源文件的咕task任务,拿一个值的映射: grunt.initConfig({ myTask: { myTarget: { src: … dest: … values: { secret: 'ABC' } } } }) 并生成输出文件: <html> <body> <span>ABC</span> </body> </html> 有没有这样的任务? 我看到了grunt-mustache-html,但它强制许多事情存在,我真的不需要,我不想使用它。 我只想简单地拿一个小胡子(或hbs或其他),用来自grunt-level对象的数据填充它,然后将结果转储到另一个HTML文件中,就这些了。

咕噜注册一个注册任务?

我已经做了一些研究,并没有find一个好的解决scheme,我正在寻找做的。 我在构build过程中需要更多的信息,并想知道是否有可能在注册的任务中出现grunt日志? 这是我所尝试的,没有工作。 grunt.registerTask('build', [ 'handlebars', 'jshint', 'cssmin', grunt.log.writeln('starting to run html minification), 'htmlmin' ]); 任务运行时,有没有办法让我坚持这些通知? 感谢您的帮助。

如何解决Gruntfile.js中错误configuration的grunt-connect-proxy设置的404错误?

背景: 我正在尝试将我的grunt服务器实例连接到在localhost上运行在同一台机器上的API服务:8080 / api /。 目前使用grunt-connect-proxy来实现这一点。 问题/问题: http://localhost:9000/api/user-profile/ Failed to load resource: the server responded with a status of 404 (Not Found) 我的configuration(下面)是否有一个错误,防止/api请求redirect到localhost:8080的代理服务器? 我的设置(Gruntfile.js): var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest; … // Grunt configuration grunt.initConfig({ // Project settings someApp: appConfig, // The grunt server settings connect: { options: { port: 9000, hostname: 'localhost', livereload: 35729 }, server: […]