Build tool for Open Social themes. The sweet pea is a plant that can grow well on its own, smells lovely and even helps other flowers grow. That's exactly what this build tool does.
The socialbase theme currently has a gulp task specifically for mime-icons that's implemented as follows:
// #################//// Image mime icons//// #################//// Copy the mime icons from the components folder to the assets folder (manual task)// ===================================================gulp.task('mime-image-icons',function(){returngulp.src(options.icons.src+'mime-icons/*.png').pipe(gulp.dest(options.basetheme.build+'images/mime-icons/'))});
This task seems to have been unneeded for a long time but being able to configure copying of certain folders is a useful feature.
// #################//// Sprite icons//// #################//// svgmin minifies our SVG files and strips out unnecessary// code that you might inherit from your graphics editor.// svgstore binds them together in one giant SVG container called// icons.svg. Then cheerio gives us the ability to interact with// the DOM components in this file in a jQuery-like way. cheerio// in this case is removing any fill attributes from the SVG// elements (you’ll want to use CSS to manipulate them)// and adds a class of .hide to our parent SVG. It gets// deposited into our inc directory with the rest of the HTML partials.// ===================================================varsvgmin=require('gulp-svgmin'),svgstore=require('gulp-svgstore'),cheerio=require('gulp-cheerio');gulp.task('sprite-icons',function(){returngulp.src(options.icons.src+'*.svg').pipe(svgmin()).pipe(svgstore({inlineSvg: true})).pipe($.rename('icons.svg')).pipe(cheerio({run: function($,file){$('svg').addClass('hide');},parserOptions: {xmlMode: true}})).pipe(gulp.dest(options.icons.dest))});
Currently only themes are supported. However, modules in the Open Social distribution also have SCSS/JS files and should adhere to the same coding standards and compilation style as themes.
We should add a -d/--directory option that allows you to specify a different folder than the current working directory (or even multiple directories at the same time).
A -w/--watch option should be added to automatically re-run the selected task on a watched file. This is currently supported in the gulp set-up but is not yet supported in Sweet Pea.
We should use https://github.com/paulmillr/chokidar to do this because it has better performance when used with Docker than the built-in Node fs.watch.
#7 requires some files from the base theme to be compiled alongside files in the current theme. This means that the DrupalTheme class should be aware of parent themes and potentially load parent themes from the theme.info.yml file.
The current gulp workflow creates some separate stylesheets for the color module preview (with a class prefix). This is not yet supported in Sweet Pea but should be added.
// #################//// Image icons//// #################//// Besides the sprite we sometimes still need the individual svg files// to load as a css background image. This task optimises and copies// the icons to the assets folder.// ===================================================gulp.task('image-icons',function(){returngulp.src(options.icons.src+'*.svg').pipe(svgmin()).pipe(gulp.dest(options.basetheme.build+'images/icons/'))});