Last active
August 29, 2015 14:17
-
-
Save thomasfr/ce99404a4fe4f0335242 to your computer and use it in GitHub Desktop.
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
options: { | |
patterns: [ | |
{ | |
src: ['assets/js/**/*.js', 'assets/css/**/*.css',], | |
search: /@@([^@]+?)@@/g, | |
replace: function(matched, part, offset, string) { | |
if(summary[part]) { | |
return summary[part]; | |
} | |
else { | |
return part; | |
} | |
} | |
} | |
] | |
} |
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
var summary = { | |
'/js/custom/index.js' : '/js/custom/index.a67bcd.js', | |
'/js/custom/facilitySearch.js' : '/js/custom/facilitySearch.k89han.js', | |
'/img/foo/bar/eversport.png' : '/img/foo/bar/eversport.9iasdui.png', | |
}; | |
var search = /@@([^@]+?)@@/g; | |
var htmlString = ` | |
block append scripts | |
script(src="@@/js/custom/index.js@@") | |
<script src="@@/js/custom/boostrap.js@@"></script> | |
<p> | |
<h1>Hallo Welt</h1> | |
</p> | |
<script src="@@/js/custom/facilitySearch.js@@"></script> | |
`; | |
var cssString = ` | |
body { | |
background-image: url('@@/img/foo/bar/eversport.png@@'); | |
} | |
`; | |
var replace = function(matched, part, offset, string) { | |
if(summary[part]) { | |
return summary[part]; | |
} | |
else { | |
return part; | |
} | |
}; | |
htmlString.replace(search, replace); | |
cssString.replace(search, replace); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment