-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added: support for dynamic attributes
- Loading branch information
Showing
6 changed files
with
135 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var loaderUtils = require('loader-utils'); | ||
|
||
module.exports = function (source) { | ||
if (this.cacheable) { | ||
this.cacheable(); | ||
} | ||
var query = this.query instanceof Object ? this.query : loaderUtils.parseQuery(this.query); | ||
|
||
var allLoadersButThisOne = this.loaders.filter(function(loader) { | ||
return loader.module !== module.exports; | ||
}); | ||
|
||
// This loader shouldn't kick in if there is any other loader | ||
if (allLoadersButThisOne.length > 0) { | ||
return source; | ||
} | ||
|
||
return 'module.exports = ' + JSON.stringify(query.url); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<img src="images/{{imgFile}}" alt="{{imgDescription}}"> | ||
<img src="/images/{{imgFile}}"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = (Handlebars['default'] || Handlebars).template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) { | ||
var helper, alias1=helpers.helperMissing, alias2="function", alias3=this.escapeExpression; | ||
|
||
return "<img src=\"images/" | ||
+ alias3(((helper = (helper = helpers.imgFile || (depth0 != null ? depth0.imgFile : depth0)) != null ? helper : alias1),(typeof helper === alias2 ? helper.call(depth0,{"name":"imgFile","hash":{},"data":data}) : helper))) | ||
+ "\" alt=\"" | ||
+ alias3(((helper = (helper = helpers.imgDescription || (depth0 != null ? depth0.imgDescription : depth0)) != null ? helper : alias1),(typeof helper === alias2 ? helper.call(depth0,{"name":"imgDescription","hash":{},"data":data}) : helper))) | ||
+ "\">\n<img src=\"/images/" | ||
+ alias3(((helper = (helper = helpers.imgFile || (depth0 != null ? depth0.imgFile : depth0)) != null ? helper : alias1),(typeof helper === alias2 ? helper.call(depth0,{"name":"imgFile","hash":{},"data":data}) : helper))) | ||
+ "\">"; | ||
},"useData":true}); |