I've found this wonderful tool which does exactly what I want:
https://www.npmjs.org/package/gulp-template-compile
Usage (as simple as):
gulp.task('templates', function () {
gulp.src('./views/templates/**/*.html')
.pipe(template()) // converts html to JS
.pipe(concat('templates.js'))
.pipe(gulp.dest('./js/dist/'))
});
Then you can access the key/value object with window.JST
. The values are functions (I don't know why, but it's like that)
Update - August 21, 2015
I've decided to use use gulp-file-contents-to-json which is the most simple thing possible for generating JSON from files' contents.
Update - July 19, 2016
I've created 3 NPM packages (might be handy to someone):