Skip to content

Instantly share code, notes, and snippets.

@alissonbovenzo
Created January 18, 2015 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alissonbovenzo/87c670fca368ee4ab981 to your computer and use it in GitHub Desktop.
Save alissonbovenzo/87c670fca368ee4ab981 to your computer and use it in GitHub Desktop.
gulp.task('dist',function(){
fs.readFile('./app/index.html', {encoding: 'utf-8'} ,function (err, data){
//pega todos as dependencias vindas do bower
var patternBower = /(bower.+js)/g
, appPath = 'app/'
, bowerDependencys = data.match(patternBower);
for(var i = bowerDependencys.length -1 ; i ; i--){
var srcPath = appPath + bowerDependencys[i]
, destPath = appPath + 'js/vendor/'
, archiveName = bowerDependencys[i].split('/').reverse()[0];
fs.writeFileSync(destPath + archiveName, fs.readFileSync(appPath+bowerDependencys[i])); // copia de arquivos sincrona
}
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment