/* * Export Genericons */ 'use strict'; var multiline = require('multiline'); module.exports = function(grunt) { // Project configuration. grunt.initConfig({ // Minify SVGs from svg directory, output to svg-min svgmin: { dist: { files: [{ attrs: 'fill', expand: true, cwd: 'svg', src: ['*.svg'], dest: 'svg-min/', ext: '.svg' }] }, options: { plugins: [ { removeAttrs: { attrs: ['fill', 'id', 'style'] } }, { removeViewBox: false }, { removeEmptyAttrs: false } ] } }, // Create single SVG sprite for use outside of React environments, output to svg-sprite svgstore: { withCustomTemplate:{ options: { prefix : '', // Unused by us, but svgstore demands this variable svg: { // will add and overide the the default xmlns="http://www.w3.org/2000/svg" attribute to the resulting SVG viewBox : '0 0 16 16', xmlns: 'http://www.w3.org/2000/svg' }, cleanup : ['style', 'fill', 'id'], includedemo : multiline.stripIndent(function(){/*
Generic looking icons, suitable for a blog or simple website.
{{{svg}}}{{title}}
An Automattic Portrayal
*/}) }, files: { 'svg-sprite/genericons-neue.svg': ['svg/*.svg'] } }, }, rename: { moveThis: { src: 'svg-sprite/genericons-neue-demo.html', dest: 'svg-sprite/index.html' }, }, copy: { main: { src: 'svg-sprite/index.html', dest: 'docs/index.html' } }, // generate a web font webfont: { icons: { src: 'svg/*.svg', dest: 'icon-font' }, options: { 'font': 'Genericons-Neue', 'types': 'eot,woff2,woff,ttf', 'order': 'eot,woff,ttf', 'embed': true, 'relativeFontPath': 'icon-font', templateOptions: { baseClass: 'genericons-neue', classPrefix: 'genericons-neue-', mixinPrefix: 'genericon-neue-' }, codepointsFile: 'codepoints.json' } }, cssmin: { target: { files: [{ expand: true, cwd: 'icon-font/', src: ['*.css', '!*.min.css'], dest: 'icon-font/', ext: '.min.css' }] } }, }); // Load the copier grunt.loadNpmTasks('grunt-contrib-copy'); // Load the SVGstore grunt.loadNpmTasks('grunt-svgstore'); // Load the renamer grunt.loadNpmTasks('grunt-rename'); // Load svgmin grunt.loadNpmTasks('grunt-svgmin'); // load the webfont creater grunt.loadNpmTasks('grunt-webfont'); // minify css files grunt.loadNpmTasks('grunt-contrib-cssmin'); // Update all files in svg-min to add a