grunt-durandal
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "grunt-durandal", | ||
"description": "Grunt Durandal Builder - Build durandal project using a custom require config and a custom almond", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/spatools/grunt-durandal.git", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -1,3 +0,2 @@ | ||
grunt-durandal | ||
============== | ||
# grunt-durandal [![NPM version](https://badge.fury.io/js/grunt-durandal.png)](http://badge.fury.io/js/grunt-durandal) | ||
@@ -68,4 +67,5 @@ Grunt task to build Durandal projects using a custom require config with a custom almond | ||
* 0.1.1 Fix issue with path separator on Windows | ||
* 0.1.2 Fix naming path issue by renaming path for forced includes | ||
[grunt]: https://github.com/gruntjs/grunt | ||
[doc-options]: https://github.com/spatools/grunt-durandal/wiki/Task-Options |
@@ -83,10 +83,19 @@ /* | ||
function includePath(array, baseUrl, outputPath, url) { | ||
if (url.indexOf(outputPath) !== -1 || url.indexOf("durandal/amd") !== -1) | ||
function includePath(array, config, url) { | ||
if (url.indexOf(config.out) !== -1 || url.indexOf("durandal/amd") !== -1) | ||
return; | ||
var ext = path.extname(url); | ||
url = path.relative(baseUrl, url); | ||
url = path.relative(config.baseUrl, url); | ||
url = url.replace(/\\/g, "/"); | ||
var pathToReplace = _.chain(config.paths) | ||
.map(function (_path, key) { return { key: key, path: _path }; }) | ||
.filter(function (_path) { return url.indexOf(_path.path) !== -1; }) | ||
.max(function (_path) { return _path.path.length; }) | ||
.value(); | ||
if (pathToReplace) | ||
url = url.replace(pathToReplace.path, pathToReplace.key); | ||
if (ext === ".html") { | ||
@@ -108,2 +117,3 @@ url = "text!" + url; | ||
var done = this.async(), | ||
config, | ||
params = this.options({ | ||
@@ -119,9 +129,9 @@ baseUrl: "app/", | ||
ensureRequireConfig(params); | ||
config = _.extend({}, defaultRequireConfig, params); | ||
this.files.forEach(function (file) { | ||
file.src.forEach(_.partial(includePath, params.include, params.baseUrl, params.out)); | ||
file.src.forEach(_.partial(includePath, config.include, config)); | ||
}); | ||
ensureRequireConfig(params); | ||
var config = _.extend({}, defaultRequireConfig, params); | ||
requirejs.optimize( | ||
@@ -128,0 +138,0 @@ config, |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
2395477
45022
1