Skip to content

Instantly share code, notes, and snippets.

@jinzhubaofu
Last active August 29, 2015 14:06
Show Gist options
  • Save jinzhubaofu/ae52157a99f38e5276a5 to your computer and use it in GitHub Desktop.
Save jinzhubaofu/ae52157a99f38e5276a5 to your computer and use it in GitHub Desktop.
edp md5renamer example
require.config({
baseUrl: '{%$tplData.feRoot%}/src',
paths: {
moye: '../dep/moye/src/ui',
etpl: '../dep/etpl/2.1.0/src/main',
Q: '../dep/q/q',
underscore: '../dep/underscore/1.6.0/src/underscore',
common: './common/'
},
packages: [{
name: 'when',
main: 'when'
}],
urlArgs: '{edp-variable:version}'
});
var variable = new VariableSubstitution({
files: ['*.tpl'],
variables: {
version: process.env.CENTER_BRANCH || process.env.BUILD_NUMBER || '1.0.0'
}
});
var tplMD5Renamer = new MD5Renamer({
files: [
'src/**/*.tpl',
'*.less', '*.png', '*.jpg', '*.gif', '*.jpeg',
'*.eot', '*.svg', '*.ttf', '*.woff'
],
resolve: function (lookup, a) {
if (a.indexOf('/dep/') !== -1) {
return false;
}
return a.indexOf( '{%$tplData.feRoot|escape:html%}' ) === 0
? a.replace( '{%$tplData.feRoot|escape:html%}/', '' )
: false;
},
outputTemplate: '{basename}.{md5sum}{extname}'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment