标签: gruntjs

yeoman/grunt任务:将文件夹复制到dist

我是yeoman和grunt的新手,我不知道如何将我在app目录中创建的文件夹复制到dist目录.

该文件夹是/ data/locales/lng/_ ns _.json,有几个lng文件夹和多个ns文件.

我想将整个结构复制到dist目录.

我尝试了复制任务并添加了这个:

{
    cwd: '<%= yeoman.app %>',
    dest: '<%= yeoman.dist %>',
    src: [
        'data/**/*.{json}'
    ]
}
Run Code Online (Sandbox Code Playgroud)

但它不起作用......

directory gruntjs yeoman

0
推荐指数
1
解决办法
4196
查看次数

简单的Grunt复制命令不起作用

我知道有一些非常明显的东西我不知道但我却看不到它.我有这个简单的Grunt复制文件,我正在运行.

copy: {
        dev: {
            files: [
                {
                    expand: true,
                    src: [
                        "../index.html",
                        "../views/**",
                        "../scripts/**",
                        "../styles/**",
                        "../data/**",
                        "../images/**"
                    ],
                    dest: "../../iPhone/www/"
                }
            ]
        }

}
Run Code Online (Sandbox Code Playgroud)

每次我运行这个文件都进入../../iPhone文件夹而不是../../iPhone/www文件夹.当我特意说要复制到www文件夹时,我不明白为什么它会复制一级.我再次知道我错过了一些如此微不足道的小事,但我却看不到它.提前致谢.

编辑:刚发现一些非常有趣的东西.如果我在www之后添加一个任意文件夹(即../../iPhone/www/assets),那么它将正确地复制到www文件夹,因为它距离资产一级并且未创建资产文件夹.

gruntjs

0
推荐指数
1
解决办法
2680
查看次数

如何列出给定的grunt任务依赖于Makefile的所有文件?

由于Grunt不支持仅重建已更改的内容,因此我想在其周围包装一个Makefile,以便只计算"输入"文件集并且根本不调用grunt,除非它们自上次构建以来已经更改.

你能告诉grunt只是列出某个特定任务在stdout上依赖的文件吗?

makefile node.js gruntjs

0
推荐指数
1
解决办法
1013
查看次数

Grunt cdnify创建了破碎的AngularJS CDN链接

我使用Yeoman/Grunt和Angular生成器,运行后grunt build,我的dist/index.html中的AngularJS引用如下所示:

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

所以,http:缺少,我手动必须改为:

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

原始index.html中,引用如下所示:

<script src="bower_components/angular/angular.js"></script>
Run Code Online (Sandbox Code Playgroud)

这是我的配置错误Gruntfile.js吗?

angularjs gruntjs yeoman

0
推荐指数
1
解决办法
1410
查看次数

Cucumber JS可以看到我的功能,但似乎没有运行步骤

我在我的解决方案中设置了Cucumber-JS和Grunt-JS.

我的文件夹结构如下所示:

+ Project
  + features
    - Search.feature
    + step_definitions
      - Search_steps.js
    + support
      - world.js
  - package.json
  - gruntfile.js
Run Code Online (Sandbox Code Playgroud)

我在gruntfile.js中添加了一个Cucumber-JS任务:

// Project configuration.
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    cucumberjs: {
        src: 'features',
        options: {
            steps: 'features/step_definitions',
            format: 'pretty'
        }
    }
});

grunt.loadNpmTasks('grunt-cucumber');

grunt.registerTask('default', ['cucumberjs']);
Run Code Online (Sandbox Code Playgroud)

我已经写出了我的功能文件:

Feature: Search
    As a user of the website
    I want to search
    So that I can view items

    Scenario: Searching for items
        Given I am on the website
        When I go to the homepage
        Then I …
Run Code Online (Sandbox Code Playgroud)

javascript cucumber gruntjs

0
推荐指数
1
解决办法
4572
查看次数

可以将Grunt任务配置为运行单个Karma测试吗?

在开发测试时,我希望能够仅运行一次Karma单元测试.有没有办法只使用Karma从命令行运行一个测试,或者在Grunt中配置一个只运行一个测试的简单任务?

gruntjs karma-runner karma-jasmine

0
推荐指数
1
解决办法
3609
查看次数

Grunt not running on Windows 8

I got the following message when I try to run grunt:

grunt 'grunt' n'est pas reconnu en tant que commande interne ou externe, un programme exécutable ou un fichier de commandes.

(using google translate)

grunt 'grunt' is not recognized as an internal or external command, operable program or batch file.

My computer is new, I just installed node.js on it, with windows 8. Maybe I missed something?

I have grunt and other grunt-contrib in my node_modules folder. So I don't …

node.js gruntjs windows-8.1

0
推荐指数
1
解决办法
4594
查看次数

与Zurb基金会合作入门

我有兴趣通过GitHub为Zurb Foundation项目做贡献.但是,我无法弄清楚如何构建项目.我已成功从https://github.com/zurb/foundation.git克隆了存储库.

当我从命令行运行时grunt,收到一条错误消息:

grunt-cli: The grunt command line interface. (v0.1.11)

Fatal error: Unable to find local grunt.
Run Code Online (Sandbox Code Playgroud)

我然后运行npm install grunt,并npm install grunt-cli通过命令行.执行此操作后,我收到一条错误消息:

Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module 'highlight.js'
Warning: Task "default" not found. Use --force to continue.
Run Code Online (Sandbox Code Playgroud)

但是,当我打开Gruntfile.js时,我可以看到确实存在"默认"任务.我究竟做错了什么?我真的想弄清楚如何在我的本地环境中建立Zurb Foundation,以便我可以开始贡献.

谢谢

zurb-foundation gruntjs

0
推荐指数
1
解决办法
379
查看次数

为livereload配置Gruntfile.js

我正在使用Laravel作为我的后端框架,我希望在发生某些文件修改时进行实时重新加载.我仍然没有成功配置Gruntfile.js使其工作.

我想,我应该需要2个插件,grunt-contrib-watch和grunt-contrib-connect,我已经配置了Grutnfile.js如下.

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        watch: {
            options: {
                livereload: true
            },
            page: {
                files: ['*.php', '*.html'],
                tasks: ['connect']
            }
        },

        connect: {
            options: {
                port: 8000,
                protocol: 'http',
                hostname: '*',
                livereload: true
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-connect');

    grunt.registerTask('do-server', ['watch']);
    grunt.registerTask('do-connect', ['connect']);
};
Run Code Online (Sandbox Code Playgroud)

请帮助我把事情搞定,当事情变得正确时,我只需要像咕噜咕噜地运行那样连接然后grunt将为我启动浏览器或者我必须手动打开浏览器和浏览器到指定的端口???

谢谢.

gruntjs grunt-contrib-watch

0
推荐指数
1
解决办法
1374
查看次数

Grunt autoprefixer没有前缀

我正在涉足Grunt.我正在尝试自动编写一个自动修复我的CSS的任务.

这是我的Gruntfile

module.exports = function(grunt) {
  'use strict';
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    autoprefixer: {
      options: {
        browsers: ['last 8 versions']
      },
      files: {
        'css/styles.css': 'css/styles.css'
      }
    },
    watch: {
      sass: {
        files: ['sass/**/*.{scss,sass}','sass/_partials/**/*.{scss,sass}'],
        tasks: ['sass:dist', 'autoprefixer']
      },
      livereload: {
        files: ['*.html', '*.php', 'js/**/*.{js,json}', 'css/*.css','img/**/*.{png,jpg,jpeg,gif,webp,svg}'],
        options: {
          livereload: true
        }
      }
    },
    sass: {
      dist: {
        files: {
          'css/styles.css': 'sass/styles.scss'
        }
      }
    }
  });
  grunt.registerTask('default', ['sass:dist', 'autoprefixer', 'watch']);
  grunt.loadNpmTasks('grunt-sass');
  grunt.loadNpmTasks('grunt-autoprefixer');
  grunt.loadNpmTasks('grunt-contrib-watch');
};
Run Code Online (Sandbox Code Playgroud)

当我运行grunt时,它说它正在运行任务很好但是当我检查css文件时,没有任何处理.

我错过了什么吗?(答案是肯定的,但我想知道:))

css vendor-prefix gruntjs

0
推荐指数
1
解决办法
6090
查看次数