Skip to content

Instantly share code, notes, and snippets.

@mortenson
Created March 19, 2018 15:27
Show Gist options
  • Save mortenson/56e46e218955ae6e0e44ef1c7859e16d to your computer and use it in GitHub Desktop.
Save mortenson/56e46e218955ae6e0e44ef1c7859e16d to your computer and use it in GitHub Desktop.
#2952390 off-canvas css renamer - download to docroot/renamer, run npm install, then "grunt"
const glob = require('glob');
let files = {};
glob.sync('../core/**/off-canvas*.css').forEach((file) => {
files[file] = file;
});
module.exports = (grunt) => {
grunt.loadNpmTasks('grunt-css-selectors');
grunt.initConfig({
css_selectors: {
options: {
mutations: [
// Append to end of string or before the first colon.
// Ex: #foo => #foo:not(...), #foo:after => #foo:not(...):after
{search: /(?=:)|$/, replace: ':not(.js-off-canvas-ignore)'}
],
indent: ' ',
},
your_target: {
files: files,
},
},
});
grunt.registerTask('default', ['css_selectors']);
}
{
"name": "renamer",
"version": "1.0.0",
"devDependencies": {
"glob": "^7.1.2",
"grunt": "^1.0.2",
"grunt-css-selectors": "^1.3.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment