Tag: gruntjs

grunt-contrib-clean删除除一个文件夹及其内容以外的所有文件夹/文件

你将如何否定使用grunt-contrib-clean清理特定文件夹。 否定比赛似乎不起作用。 clean: { plugins: [ 'app/plugins/myplugin', '!app/plugins/myplugin/assets' ] } 我已经尝试了一些不同的否定模式,比如: '!app/plugins/myplugin/assets' '!app/plugins/myplugin/assets/**' 以及在重要的情况下颠倒arrays中的位置。 似乎无法坚持资产文件夹/干净的内容。 资产文件夹包含jQuery,AngularJS和build立Bootstrap(SASS),我不想保留复制/build立,似乎是浪费时间。

Grunt – 使用时间戳压缩和包含资产

我花了整整一天的时间来试图弄清楚如何从Grunt开始,但是我能够find的所有文档(在GitHub上)都指定了选项,而没有其他的东西。 我正在寻找一个更方便用户的文档/方法,因为我是Grunt本身的新手。 我想自动化缩小几个.css文件的过程,并将它们包含在我的模板中的一个占位符中定义为 <!– styles –> <!– /styles –> 和 <!– js –> <!– /js –> Grunt应该做的是: 看看我的CSS目录里面 压缩文件在一个“main.css”和“main.js”应用程序 打开html模板(如果它不需要tmp版本,而是能够更新相同的html文件,那么将会很好),并在那里写入链接到创build的文件的最终<link>和<script>标签一个时间戳(用于caching清除) 在我看来,这似乎是一种常见的方法,但我无法在那里find任何东西。 我看着“grunt-contrib-cssmin”,“cartero”,“grunt-includes”,“grunt-include-replace”,“grunt-usemin”以及大量的替代品……但似乎没有把所有的要求和我他们不能让他们工作以获得我想要的东西。

Grunt扩展文件,在src中可以接受哪些模式?

从gruntfile.js中摘录 sass: { compile: { files: [{ expand: true, cwd: 'css/', src: ['^[^_].scss'], dest: '../css/', ext: '.css' }] } }, 这应该根据rubular工作。 基本上我想编译'css'目录中的所有.scss文件,除非它们以下划线开头。 但是,这种模式不匹配什么? 有任何想法吗?

设置与波本威士忌的grunt-contrib-sass

我正在尝试添加波本威士忌作为依赖项目,在那里使用grunt-contrib-sass 。 node-bourbon对于grunt和Sass的整合有如下的说法: grunt.initConfig({ sass: { dist: { options: { // THIS IS THE LINE I ADDED TO MY CONFIG includePaths: require('bourbon').includePaths, outputStyle: 'compressed' }, files: { 'path/to/output.css': 'path/to/input.scss' } } } }); 但是,当运行咕噜我得到以下错误: OptionParser::InvalidOption: invalid option: –include-paths 这个错误出现在任何包含includePaths的path中,而不仅仅是波旁。 我究竟做错了什么?

grunt-contrig-imagemin警告:不能调用未定义的方法“replace”

试图使用imagemin时,我收到一个奇怪的警告,什么也没有发生。 grunt imagemin:primary Warning: Cannot call method 'replace' of undefined Used –force, continuing. Done, but with warnings. 我的任务给了我错误如下 grunt.config 'imagemin' primary: options: optimizationLevel: 7 expand: true cwd: "assets" src: "{img,img_two}/**/*.{jpg,jpeg,gif,png}" dest: "public/compiled/img" grunt.loadNpmTasks 'grunt-contrib-imagemin' 这些不起作用 src: "img/**/*.{jpg,jpeg,gif,png}" src: "{img,img_two}/**/*.{jpg,jpeg,gif,png}" 这些工作 src: "img/**/*.jpg" src: "{img,img_two}/**/*.jpg" 所以它似乎不喜欢多个扩展语法,但为什么,它甚至是如何在这个例子中完成? 更新:它似乎只是PNG不起作用,无论我自己做的扩展或组内匹配。 我在Windows 8上,NPM 1.4.3 https://github.com/gruntjs/grunt-contrib-imagemin/issues/219

Grunt-contrib-watch没有看到新的文件

我做了这样的Gruntfile.js: 'use strict'; module.exports = function (grunt) { grunt.loadNpmTasks('grunt-favicons'); grunt.loadNpmTasks('grunt-contrib-imagemin'); grunt.loadNpmTasks('grunt-bake'); grunt.loadNpmTasks('grunt-contrib-htmlmin'); grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-autoprefixer'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-cwebp'); grunt.loadNpmTasks('grunt-responsive-images'); grunt.loadNpmTasks('grunt-retinafy'); grunt.loadNpmTasks('grunt-spritesmith'); grunt.loadNpmTasks('grunt-notify'); grunt.loadNpmTasks('grunt-contrib-watch'); require('load-grunt-tasks')(grunt); grunt.initConfig({ pkg : grunt.file.readJSON('package.json'), watch: { html: { files: ['./assets/**/*.html'], tasks: ['html'], options: { spawn: false, livereload: true, }, }, less: { files: ['./assets/less/**/*.less'], tasks: ['less_files'], options: { spawn: false, livereload: true, […]

咕噜玉错误

每当我运行咕噜玉,我得到一个错误: Warning: pattern.indexOf is not a function Use –force to continue. 现在,这是我的玉石任务: jade: { options: { pretty: true }, all: { files: { expand:true, cwd: 'src/static/jade', ext: "html", src: ['src/static/jade/**/*.jade', '!src/static/jade/_includes'], dest: 'build/' } } } 所以基本上我试图把src/static/jade的jade文件(包括除了_include之外的_include )放到build ,保持目录结构。 我尝试了评论expand线,但它给了我: Warning: Unable to read "src/static/jade" file (Error code: EISDIR). Use –force to continue. 也许我正在做这个错误的方式。 我应该如何解决这个问题?

致命的错误:产卵cmd ENOENT – 咕serve服务

我正在尝试使用grunt serve命令启动我的angular度应用程序,但是我遇到了致命错误:spawn cmd ENOENT。 我用下面的命令来生成我的Angular应用程序 npm install -g yo grunt-cli bower npm install -g generator-angular yo angular npm install bower install 然后我用grunt serve命令启动我的应用程序 但它不工作。 系统信息:操作系统:Windows 7 64位npm版本:2.11.3 请帮助我,我经历了所有的咕噜文档,但没有线索。

使用Grunt ENOTSUP

我正在使用Grunt来缩小和连接AngularJS Web应用程序的文件。 我们的来源是文件共享,我通过映射的驱动器连接到它。 每当Grunt运行我的源代码目录时,我的一个concat任务出现错误。 错误是“ENOTSUP,在套接字上不支持操作”。 如果我复制源,本地,Grunt运行,罚款。 为了我们的源代码控制,我需要Grunt来监视和运行映射的驱动器。 concat任务使用grunt-contrib-concat。 我已经尝试重新安装Node,并将grunt-contrib-concat回滚到版本0.4.0。 这没有用。 任何帮助/想法将不胜感激。 编辑: Grunt中给出错误的代码是: jscustom: { src: ['src/js/*.js', 'src/js/**/*.js', 'build/temp/templates.js'], dest: 'build/temp/custom.js' } 如果我从上面的代码中删除“'src / js / ** / *。js',并执行我的Grunt任务,ENOTSUP错误不会发生。 我需要使用这些通配符来包含所有的目录和文件。

删除nodejs devDependencies

有没有办法删除nodeJs devDependencies而不删除一切。 我在目标服务器上没有npm,所以我执行以下操作: $ npm install $ grunt build $ rm -rf node_modules $ npm install –production 有谁知道是否存在可以清除已安装模块的npm模块。 TIA!