Grunt task to build Durandal projects using a custom require config with a custom almond
JavaScript Other
Latest commit fc2bca2 May 16, 2016 @SomaticIT SomaticIT Update package version
Permalink
Failed to load latest commit information.
app Add grunt 1.0.0 compatibility May 16, 2016
content Review repository architecture May 16, 2016
scripts Review repository architecture May 16, 2016
tasks Add grunt 1.0.0 compatibility May 16, 2016
.gitattributes
.gitignore Add grunt 1.0.0 compatibility May 16, 2016
.npminclude Add .npminclude Jun 4, 2013
Gruntfile.js Add grunt 1.0.0 compatibility May 16, 2016
LICENSE Initial Release Jun 4, 2013
README.md Integrate includeMain option Feb 9, 2014
package.json
packages.config Upgrade tests to durandal 2.0 Sep 16, 2013

README.md

grunt-durandal NPM version

Grunt task to build Durandal projects using a custom require config with a custom almond

Getting Started

Install this grunt plugin next to your project's gruntfile with: npm install grunt-durandal --save-dev

Then add this line to your project's Gruntfile.js :

grunt.loadNpmTasks("grunt-durandal");

Then specify your config: (more informations)

grunt.initConfig({
    durandal: {
        dist: {
            src: [
                "app/**/*.*",
                "scripts/durandal/**/*.*"
            ],
            options: {
                baseUrl: "app/",
                mainPath: "app/main.js",
                out: "app/main-built.js",

                uglify2: {
                    compress: {
                        global_defs: {
                            DEBUG: false
                        }
                    }
                }
            }
        }
    }
});

Using the configuration above, consider the following app structure :

  • App
    • viewmodels
      • shell.js
      • home.js
    • views
      • shell.html
      • home.html
    • main.js
  • Scripts
    • durandal
      • all durandal files
    • require.js
    • text.js
    • almond-custom.js

After running the grunt task, a main-built file will be created in your app folder. This file contains a custom almond, and all your modules inlined (views included as text!...)

Release History

  • 0.0.1 Initial Release
  • 0.1.0 Update to Durandal 2.0
  • 0.1.1 Fix issue with path separator on Windows
  • 0.1.2 Fix naming path issue by renaming path for forced includes
  • 0.1.3 Append a includeMain options which allow to disable automatic main include