-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #256 from 2gis/fix/templates-build
Research template engines
- Loading branch information
Showing
13 changed files
with
81 additions
and
65 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
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,22 @@ | ||
var path = require('path'); | ||
var gulp = require('gulp'); | ||
var dust = require('gulp-dust'); | ||
|
||
var config = require('../../app/config.js'); | ||
var deps = require('../deps')(config); | ||
|
||
module.exports = function (pkg) { | ||
var templateList = deps.getModulesList(pkg) | ||
.map(function(moduleName) { | ||
return 'src/' + moduleName + '/templates/*.dust'; | ||
}); | ||
|
||
return gulp.src(templateList).pipe(dust({ | ||
name: function (file) { | ||
var moduleName = path.basename(path.dirname(path.dirname(file.path))); | ||
var templateName = path.basename(file.relative, '.dust'); | ||
|
||
return moduleName + '/' + templateName; | ||
} | ||
})); | ||
} |
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 |
---|---|---|
@@ -1,17 +1,12 @@ | ||
DG.dust = function (tmpl) { | ||
return function (name, data) { | ||
if (!dust.cache[name]) { | ||
dust.loadSource(tmpl[name]); | ||
} | ||
DG.dust = function (name, data) { | ||
var result; | ||
|
||
var result; | ||
// The callback is called synchronously, so this works | ||
dust.render(name, data, function (err, html) { | ||
result = html; | ||
}); | ||
|
||
dust.render(name, data, function (err, html) { | ||
result = html; | ||
}); | ||
|
||
return result; | ||
}; | ||
return result; | ||
}; | ||
|
||
if (DG.debug) { dust.debugLevel = 'ERROR'; } |
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 was deleted.
Oops, something went wrong.