Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / paragraphs / css / gulp-tasks.js
diff --git a/web/modules/contrib/paragraphs/css/gulp-tasks.js b/web/modules/contrib/paragraphs/css/gulp-tasks.js
new file mode 100644 (file)
index 0000000..0524594
--- /dev/null
@@ -0,0 +1,37 @@
+// Define gulp tasks.
+module.exports = function(gulp, plugins, options) {
+
+  'use strict';
+
+  // Processor for linting is assigned to options so it can be reused later.
+  options.processors = [
+    // Options are defined in .stylelintrc.yaml file.
+    plugins.stylelint(options.stylelintOptions),
+    plugins.reporter(options.processorsOptions.reporterOptions)
+  ];
+
+  // Post CSS options.
+  options.postcssOptions = [
+    plugins.autoprefixer(options.autoprefixer)
+  ];
+
+  // Defining gulp tasks.
+
+  gulp.task('sass', function() {
+    return gulp.src(options.scssSrc + '/*.scss')
+      .pipe(plugins.sass({
+        outputStyle: 'expanded',
+        includePaths: options.sassIncludePaths
+      }))
+      .pipe(plugins.postcss(options.postcssOptions))
+      .pipe(gulp.dest(options.cssDest));
+  });
+
+  gulp.task('sass:lint', function () {
+    return gulp.src(options.scssSrc + '/*.scss')
+      .pipe(plugins.postcss(options.processors, {syntax: plugins.syntax_scss}))
+  });
+
+  // Default task to run everything in correct order.
+  gulp.task('default', ['sass:lint', 'sass']);
+};