From ba299b2a4c66452392a0c61ba9075ca70ac67bf7 Mon Sep 17 00:00:00 2001 From: Tobias Johansson Date: Fri, 29 Mar 2019 10:44:04 +0100 Subject: [PATCH] Documentation of es6 transcompile and packaging --- gulpfile.js | 18 +++++++++++++++++- src/scripts/js/es6/common/README.md | 2 ++ src/scripts/js/es6/individual/README.md | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/scripts/js/es6/common/README.md create mode 100644 src/scripts/js/es6/individual/README.md diff --git a/gulpfile.js b/gulpfile.js index 26cad555..92336797 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -107,10 +107,26 @@ function browserify_base(entry) { })); } +/** + * Transcompile and package common modules to be included in tutti.js. + * + * Example: + * src/scripts/js/es6/common/api/init.js + * src/scripts/js/es6/common/events/init.js + * Everything exported in api/init.js will end up in module pillar.api.*, and everything exported in events/init.js + * will end up in pillar.events.* + */ function browserify_common() { return glob.sync('src/scripts/js/es6/common/**/init.js').map(browserify_base); } +/** + * Transcompile and package individual modules. + * + * Example: + * src/scripts/js/es6/individual/coolstuff/init.js + * Will create a coolstuff.js and everything exported in init.js will end up in namespace pillar.coolstuff.* + */ gulp.task('scripts_browserify', function(done) { glob('src/scripts/js/es6/individual/**/init.js', function(err, files) { if(err) done(err); @@ -128,7 +144,7 @@ gulp.task('scripts_browserify', function(done) { }); -/* Collection of scripts in src/scripts/tutti/ to merge into tutti.min.js +/* Collection of scripts in src/scripts/tutti/ and src/scripts/js/es6/common/ to merge into tutti.min.js * Since it's always loaded, it's only for functions that we want site-wide. * It also includes jQuery and Bootstrap (and its dependency popper), since * the site doesn't work without it anyway.*/ diff --git a/src/scripts/js/es6/common/README.md b/src/scripts/js/es6/common/README.md new file mode 100644 index 00000000..3f2e9304 --- /dev/null +++ b/src/scripts/js/es6/common/README.md @@ -0,0 +1,2 @@ +Gulp will transpile everything in this folder. Every sub folder containing a init.js file exporting functions/classes +will be packed into a module in tutti.js under the namespace pillar.FOLDER_NAME. diff --git a/src/scripts/js/es6/individual/README.md b/src/scripts/js/es6/individual/README.md new file mode 100644 index 00000000..2acd0641 --- /dev/null +++ b/src/scripts/js/es6/individual/README.md @@ -0,0 +1,2 @@ +Gulp will transpile everything in this folder. Every sub folder containing a init.js file will become a file named +FOLDER_NAME.js containing the exported functions/classes under the namespace pillar.FOLDER_NAME.