]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Comment all the customizer-related things
authorGeoff Kimball <geoff@zurb.com>
Fri, 11 Mar 2016 22:03:14 +0000 (14:03 -0800)
committerGeoff Kimball <geoff@zurb.com>
Fri, 11 Mar 2016 22:03:14 +0000 (14:03 -0800)
customizer/config.yml
customizer/lib/js.js
customizer/lib/sass.js
gulp/customizer.js

index 11bd709cbd0fbed3cbc9f8e6ab687c067e7c7d26..4b7dda152ff6ca14e8a04edc1a8c2287eba3f5b9 100644 (file)
@@ -1,3 +1,9 @@
+# This is the customizer's master module list.
+# Each item in the list is a module with any of these keys:
+#   - sass: Name of the CSS export. 'grid' becomes '@include foundation-grid;'
+#   - js: Name of the JavaScript file. 'accordion' becomes 'foundation.accordion.js'
+#   - js_utils: Names of plugin dependencies. 'box' becomes 'foundation.util.box.js'
+
 grid:
   sass: grid
 
index 66f9a9eafa369f0f49ff4cd172b24a82ada47b56..d8546194bf157c0dc79958f04c362d147e8fa119 100644 (file)
@@ -1,5 +1,11 @@
 var unique = require('array-uniq');
 
+/**
+ * Creates an array of file paths that can be passed to `gulp.src()`.
+ * @param {Object} config - Customizer configuration file.
+ * @param {String[]} modules - Modules to include in the file list.
+ * @returns {String[]} Array of file paths.
+ */
 module.exports = function(config, modules) {
   var files = ['core'];
   var utils = [];
@@ -19,9 +25,13 @@ module.exports = function(config, modules) {
     }
   }
 
+  // Prune duplicate entries from the list of utility files
   utils = unique(utils);
+
+  // Combine foundation.core.js, utilities, and plugins into one array
   files = files.concat(utils, libraries);
 
+  // Format the modules as paths
   return files.map(function(file) {
     return 'js/foundation.' + file + '.js';
   });
index 086618f98999409f2e920ce06bab5559440d7129..69d6faf0a36861e6026dc5370b9dcaab6178cd92 100644 (file)
@@ -19,6 +19,13 @@ var SASS_TEMPLATE = multiline(function() {/*
   @include motion-ui-animations;
 */});
 
+/**
+ * Generates an entry point Sass file with a custom list of CSS exports and Sass variables.
+ * @param {Object} config - Customizer configuration object.
+ * @param {String[]} modules - Modules to include CSS for.
+ * @param {Object} variables - Sass variable overrides to include. The key is the name of the variable, and the value is the value.
+ * @returns {String} Formatted Sass file.
+ */
 module.exports = function(config, modules, variables) {
   var CONFIG = config;
   var variableList = [];
index 29e4f468a62ca91ceccb3bba6e2abf1d9f12b759..364557c58001c32f0c633c75efce768a3bd8e19a 100644 (file)
@@ -19,8 +19,12 @@ var ARGS = require('yargs').argv;
 var CUSTOMIZER_CONFIG;
 var MODULE_LIST;
 
+// Load the configuration file for the customizer. It's a list of modules to load and Sass variables to override
 gulp.task('customizer:loadConfig', function() {
+  // Config file with list of all Foundation modules and dependencies
   var config = fs.readFileSync('customizer/config.yml');
+
+  // Module file, created from customizer form data
   var moduleListPath = path.relative(__dirname, path.join(process.cwd(), ARGS.modules));
   var moduleList = require(moduleListPath);
 
@@ -29,6 +33,7 @@ gulp.task('customizer:loadConfig', function() {
   VARIABLE_LIST = moduleList.variables;
 });
 
+// Creates a Sass file from the module/variable list and creates foundation.css and foundation.min.css
 gulp.task('customizer:sass', ['customizer:loadConfig'], function() {
   var sassFile = customizer.sass(CUSTOMIZER_CONFIG, MODULE_LIST, VARIABLE_LIST);
 
@@ -54,6 +59,7 @@ gulp.task('customizer:sass', ['customizer:loadConfig'], function() {
     .pipe(gulp.dest('.customizer/css'));
 });
 
+// Creates a Foundation JavaScript file from the module list, and also copies dependencies (jQuery, what-input)
 gulp.task('customizer:javascript', ['customizer:loadConfig'], function() {
   var jsPaths = customizer.js(CUSTOMIZER_CONFIG, MODULE_LIST);
 
@@ -70,11 +76,18 @@ gulp.task('customizer:javascript', ['customizer:loadConfig'], function() {
     .pipe(gulp.dest('.customizer/js/vendor'));
 });
 
+// Copies the boilerplate index.html to the custom download folder
 gulp.task('customizer:html', ['customizer:loadConfig'], function() {
   return gulp.src('customizer/index.html')
     .pipe(gulp.dest('.customizer'));
 });
 
+// Creates a custom build by:
+//   - Generating a CSS file
+//   - Generating a JS file
+//   - Copying the index.html file
+//   - Creating a blank app.css file
+//   - Creating an app.js file with Foundation initialization code
 gulp.task('customizer', ['customizer:sass', 'customizer:javascript', 'customizer:html'], function(done) {
   touch('.customizer/css/app.css');
   touch('.customizer/js/app.js');