GULP TASKS for Drupal soda theme
Install
npm install gulp-tasks-soda --save
Tasks
Default paths
var paths = styles: source: 'src/templates/' destination: 'assets/css/' scripts: source: 'src/templates/' destination: 'assets/js' scriptsVendorFiles: 'node_modules/bootstrap/dist/js/bootstrap.js' images: source: 'src/media/images/' destination: 'assets/images/' fonts: source: 'src/fonts/' destination: 'assets/fonts/' styleGuide: 'styleguide' twigPages: src: 'src/templates/' componentsSrc: 'src/templates/01-components/' componentBlocksSrc: 'src/templates/02-component-blocks/' pagesSrc: 'src/templates/03-pages/' destination: 'assets/pages/' componentsDestination:'assets/pages/01-components' componentBlocksDestination:'assets/pages/02-component-blocks' pagesDestination:'assets/pages/03-pages' componentTemplateSrc: 'src/templates/component-template.twig' componentBlockTemplateSrc: 'src/templates/component-block-template.twig' svg : source: 'src/media/svgs' destination: 'assets/svg' prefix: dev: '' pro: '/svg/sprite' ;
Default options
var options = drupalLibraries: destination:'./generated.libraries.yml' // ----- Browsersync ----- // browserSync: server: baseDir: 'assets' startPath: "/pages" port: 3005 online: false open: true logConnections: true // ----- CSS ----- // css: files: path file: path destination: path // ----- Sass ----- // sass: files: path file: path destination: path AUTOPREFIXER_BROWSERS: 'ie >= 10' 'ie_mob >= 10' 'ff >= 30' 'chrome >= 34' 'safari >= 9' 'opera >= 23' 'ios >= 8' 'android >= 4.4' 'bb >= 10' // ----- JS ----- // js: files: path compiledFiles: path vendorFiles: pathsscriptsVendorFiles destination: path vendorDestination: path // ----- eslint ----- // jsLinting: files: theme: pathsscriptssource + '**/*.js' '!' + pathsscriptssource + '**/*.min.js' gulp: 'gulpfile.js' 'gulp-tasks/**/*' // ----- Fonts ----- // fonts: files: pathsfontssource + '**/*.{ttf,woff,otf,eot,svg,woff2}' destination: pathsfontsdestination // ----- Images ----- // images: files: pathsimagessource + '**/*.{png,gif,jpg,svg,xml,webmanifest}' destination: pathsimagesdestination // ----- TWIG pages ---- // twigPages: baseSrc: path src: path componentsSrc: path componentBlocksSrc: path pagesSrc: path allSrc: path //Needed for watch task destination: path componentsDestination: path componentBlocksDestination: path pagesDestination: path componentTemplateSrc: path componentBlockTemplateSrc: path svg: files: path destination: path mode: symbol: // symbol mode to build the SVG render: css: true // CSS output option for icon sizing scss: true // SCSS output option for icon sizing dest: 'sprite' // destination folder prefix: '.svg--%s' // BEM-style prefix if styles rendered sprite: 'sprite.svg' //generated sprite name example: true // Build a sample page, please! prefix: pathssvgprefix
gulpfile.js
for a Drupal theme
Example var customPaths = {};var customOptions = {}; var gulp = ;var fs = ; if fs customPaths = ;if fs customOptions = ; gulpcustomPathscustomOptions;