Last active
May 10, 2017 22:58
-
-
Save moehammoud/c945073fd18ac2dbcd0c0d7df91a6cef to your computer and use it in GitHub Desktop.
htmlbuild
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
{ | |
"name": "play1", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"gulp": "^3.9.1", | |
"gulp-htmlbuild": "^0.4.2" | |
} | |
} |
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 gulp = require('gulp'); | |
gulp.task('default', function() { | |
// place code for your default task here | |
}); | |
gulp.task('build', function () { | |
gulp.src(['./index.html']) | |
.pipe(htmlbuild({ | |
// build js with preprocessor | |
js: htmlbuild.preprocess.js(function (block) { | |
// read paths from the [block] stream and build them | |
// ... | |
// then write the build result path to it | |
block.write('buildresult.js'); | |
block.end(); | |
}) | |
})) | |
.pipe(gulp.dest('./build')); | |
}); |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<!-- htmlbuild:js --> | |
<script src="js/script1.js"></script> | |
<script src="js/script2.js"></script> | |
<!-- endbuild --> | |
</body> | |
</html> |
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
{ | |
"name": "play1", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"gulp": "^3.9.1", | |
"gulp-htmlbuild": "^0.4.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment