Created
March 19, 2018 15:27
-
-
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"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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