You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So detecting mismatches between classes in styles and templates works. The next nice feature to have would probably be an optional autoremoval.
This needs probably separate plugins as it would work roughly like this:
functionsymdiffHtmlAutoremove(fileContent,classesToRemove){varast=htmlParser.parse(fileContent);walkAst(function(node){if(node.type===CLASS_ATTR){node.content=node.content.replace(classesToRemove,'');});});returnhtmlParser.stringify(ast);// also unclear if that exists already for various parsers});
Now the question is what to do with the cleaned up CSS string. Obviously we would save it somewhere. For file handling we have the task runner plugins. So it seems to be the simplest solution to add a new configuration to them:
// gulp-symdiff, that issymdiff({templates: [symdiffHtml],css: [symdiffCss],autoremove: [symdiffHtmlAutoremove(..optionalotherautoremovers)]})
We can just feed all file contents to all autoremovers! One will work and the output we save to the destination folder. If none works, we just copy the file there. If more than one works, we make a lot of noise.
Details to be clarified:
Should the autoremover throw if it can't parse the file or return null/empty string? Not sure yet of the benefits.
People organize their project folders sometimes in crazy ways, so the file destination definition has to be very flexible. Look at how others do it. Do we have to care about this actually? In Gulp we would just emit the clean string and be done.
Check which parsers out there implement ast->string
The text was updated successfully, but these errors were encountered:
So detecting mismatches between classes in styles and templates works. The next nice feature to have would probably be an optional autoremoval.
This needs probably separate plugins as it would work roughly like this:
Now the question is what to do with the cleaned up CSS string. Obviously we would save it somewhere. For file handling we have the task runner plugins. So it seems to be the simplest solution to add a new configuration to them:
We can just feed all file contents to all autoremovers! One will work and the output we save to the destination folder. If none works, we just copy the file there. If more than one works, we make a lot of noise.
Details to be clarified:
The text was updated successfully, but these errors were encountered: