yoman不压缩html,javascript - Yeoman - task "requirejs" not found - Stack Overflow

I'm having problems with yeoman, specifically, when I try to run grunt, it fails on the requirejs, stating simply that "The task 'requirejs' doesn't exist". That is really strange, since in my gruntfile I have the options definition for requirejs, and I also have it installed in the package.json file. Do you know what could be the problem?

Thank you!

// Generated on 2013-03-14 using generator-webapp 0.1.5

"use strict";

var lrSnippet = require("grunt-contrib-livereload/lib/utils").livereloadSnippet;

var mountFolder = function(connect, dir) {

return connect.static(require("path").resolve(dir));

};

// # Globbing

// for performance reasons we"re only matching one level down:

// "test/spec/{,*/}*.js"

// use this if you want to match all subfolders:

// "test/spec/**/*.js"

module.exports = function(grunt) {

// load all grunt tasks

require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);

// configurable paths

var yeomanConfig = {

app: "app",

dist: "dist"

};

grunt.initConfig({

yeoman: yeomanConfig,

watch: {

coffee: {

files: ["/scripts/{,*/}*.coffee"],

tasks: ["coffee:dist"]

},

coffeeTest: {

files: ["test/spec/{,*/}*.coffee"],

tasks: ["coffee:test"]

},

compass: {

files: ["/styles/{,*/}*.{scss,sass}"],

tasks: ["compass"]

},

livereload: {

files: [

"/*.html",

"{.tmp,}/styles/{,*/}*.css",

"{.tmp,}/scripts/{,*/}*.js",

"/images/{,*/}*.{png,jpg,jpeg,webp}"],

tasks: ["livereload"]

}

},

clean: {

dist: [".tmp", "/*"],

server: ".tmp"

},

jshint: {

options: {

jshintrc: ".jshintrc"

},

all: [

"Gruntfile.js",

"/scripts/{,*/}*.js",

"!/scripts/vendor/*",

"test/spec/{,*/}*.js"]

},

coffee: {

dist: {

files: [{

// rather than compiling multiple files here you should

// require them into your main .coffee file

expand: true,

cwd: "/scripts",

src: "*.coffee",

dest: ".tmp/scripts",

ext: ".js"

}]

},

test: {

files: [{

expand: true,

cwd: ".tmp/spec",

src: "*.coffee",

dest: "test/spec"

}]

}

},

compass: {

options: {

sassDir: "/styles",

cssDir: ".tmp/styles",

imagesDir: "/images",

javascriptsDir: "/scripts",

fontsDir: "/styles/fonts",

importPath: "app/components",

relativeAssets: true

},

dist: {}

},

requirejs: {

dist: {

options: {

baseUrl: "app/scripts/editor",

optimize: "none",

preserveLicenseComments: false,

useStrict: true,

wrap: true

}

}

},

useminPrepare: {

html: "/index.html",

options: {

dest: ""

}

},

usemin: {

html: ["/{,*/}*.html"],

css: ["/styles/{,*/}*.css"],

options: {

dirs: [""]

}

},

imagemin: {

dist: {

files: [{

expand: true,

cwd: "/images",

src: "{,*/}*.{png,jpg,jpeg}",

dest: "/images"

}]

}

},

cssmin: {

dist: {

files: {

"/styles/main.css": [

".tmp/styles/{,*/}*.css",

"/styles/{,*/}*.css"]

}

}

},

htmlmin: {

dist: {

options: {

removeCommentsFromCDATA: true,

// https://github.com/yeoman/grunt-usemin/issues/44

//collapseWhitespace: true,

collapseBooleanAttributes: true,

removeAttributeQuotes: true,

removeRedundantAttributes: true,

useShortDoctype: true,

removeEmptyAttributes: true,

removeOptionalTags: true

},

files: [{

expand: true,

cwd: "",

src: "*.html",

dest: ""

}]

}

},

copy: {

dist: {

files: [{

expand: true,

dot: true,

cwd: "",

dest: "",

src: [

"*.{ico,txt}",

".htaccess"]

}]

}

},

bower: {

all: {

rjsConfig: "/scripts/main.js"

}

}

});

grunt.renameTask("regarde", "watch");

grunt.registerTask("server", function(target) {

if (target === "dist") {

return grunt.task.run(["build", "open", "connect:dist:keepalive"]);

}

grunt.task.run([

"clean:server",

"coffee:dist",

"livereload-start",

"connect:livereload",

"open",

"watch"

]);

});

grunt.registerTask("test", [

"clean:server",

"coffee",

"compass"

]);

grunt.registerTask("build", [

"clean:dist",

"coffee",

"compass:dist",

"useminPrepare",

"requirejs",

"imagemin",

"htmlmin",

"concat",

"cssmin",

"uglify",

"copy",

"usemin"

]);

grunt.registerTask("default", [

"jshint",

"test",

"build"

]);

};

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值