Remove class names from strings
npm install noclass --save-dev
Removes all classes from the string, unless an array is passed through to protect select classes.
var noclass = require('noclass'),
saveclasses = ['safe'];
var cleanString = noclass.classFromFile('<div class="notSafe"><div class="Safe"><div class="safe"></div></div></div>', saveclasses);
In this case cleanString
would return <div ><div ><div class="safe"></div></div></div>
.
This is because the classes will only match case sensitive.
Remove all classes from a file. The file will be read in sync.
var noclass = require('noclass'),
var cleanString = noclass.classFromFile('/path/to/file.html', []);