Domanda

I'm trying to setup a simple gruntjs task using requirejs on Windows 8, but when I run it keeps producing the follow command line error.

enter image description here

package.json:

{
"name": "my-app",
"version": "0.0.1",
"devDependencies": {
    "grunt": "~0.4.1",
    "grunt-contrib-requirejs": "~0.4.1"
}
}

Gruntfile.js: module.exports = function(grunt) {

grunt.initConfig({

    pkg: grunt.file.readJSON('package.json'),

    requirejs: {
        compile: {
            options: {
                appDir: "../",
                dir: "../../build",
                fileExclusionRegExp: /^(r|build)\.js$/,
                mainConfigFile: "js/main.js",
                removeCombined: true
            }
        }
    }

});

grunt.loadNpmTasks('grunt-contrib-requirejs');

grunt.registerTask('default', ['requirejs']);

};

I used npm install in the directory, then it installed all the dependencies. Any thoughts on how to fix this?

È stato utile?

Soluzione

So Gruntfile.js is in the public_html directory correct?

I think the way you have it configured, you're telling the requirejs task to try to uglify and combine everything in the skritter-html5/ and it's choking on that, because its running through all javascript files in your project instead of just your RequireJS app code.. What you may want the appDir option to point to is something like "js/myClientSideAppDir" and then I would output it to "js/build"

Try looking over the comments in this file. https://github.com/jrburke/r.js/blob/master/build/example.build.js

They're the best description of r.js options that we've got.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top