我是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)
但它不起作用......
我知道有一些非常明显的东西我不知道但我却看不到它.我有这个简单的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文件夹,因为它距离资产一级并且未创建资产文件夹.
由于Grunt不支持仅重建已更改的内容,因此我想在其周围包装一个Makefile,以便只计算"输入"文件集并且根本不调用grunt,除非它们自上次构建以来已经更改.
你能告诉grunt只是列出某个特定任务在stdout上依赖的文件吗?
我使用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吗?
我在我的解决方案中设置了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) 在开发测试时,我希望能够仅运行一次Karma单元测试.有没有办法只使用Karma从命令行运行一个测试,或者在Grunt中配置一个只运行一个测试的简单任务?
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 …
我有兴趣通过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,以便我可以开始贡献.
谢谢
我正在使用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将为我启动浏览器或者我必须手动打开浏览器和浏览器到指定的端口???
谢谢.
我正在涉足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文件时,没有任何处理.
我错过了什么吗?(答案是肯定的,但我想知道:))
gruntjs ×10
node.js ×2
yeoman ×2
angularjs ×1
css ×1
cucumber ×1
directory ×1
javascript ×1
karma-runner ×1
makefile ×1
windows-8.1 ×1