closure-stylesheets
closure-stylesheets copied to clipboard
CSS Renaming prefixes are no longer honored when generating renaming map
If I specify a renaming prefix, it seems to be lost in get renaming map JS. If I go back to one before this commit https://github.com/google/closure-stylesheets/commit/d4476e5295f20780cf453df8e534ceeae991fcb9 it works fine with the same parameters.
Parameters I'm using to repro
--pretty-print
--css-renaming-prefix
ja_
--output-renaming-map-format
CLOSURE_COMPILED
--rename
DEBUG
--output-file
/whatever/styles.css
--output-renaming-map
/whatever/renaming_map.js
resources/CheckBox.css
resources/RadioInput.css
resources/TextArea.css
resources/TextInput.css
Thanks for the report. I'll try to take a look soon.
I did a little more digging, the root of the issue seems to be the hyphenated selectors. If you have a selector like .foo-bar
, that gets turned into .x_a-b
in the CSS. But in the map it becomes:
"foo": "a"
"bar": "b"
If you call RecordingSubstitutionMap.get("foo-bar") in the code it correctly returns .x_a-b
(this is why the tests pass), but that doesn't help the generated map in javascript land.
Its not very clear where the prefix should go in that situation. You could put it on both (and change the CSS appropriately) or you could add a third key for the combination. It seems to me that putting it on both makes the most sense since that allows you to use each one individually and still be behind your desired prefix.
Has anything changed on this issue? It would appear that the most recent build will prepend the classnames with the prefix from the command line, but not set them in the "renaming map" file.
Setting goog.global.CLOSURE_CSS_NAME_MAP_FN
only seems to work for initial calls, which makes sense if getCssName is a compiler primitive. Wrapping goog.getCssName
also does not work.
--excluded-classes-from-renaming
might be a solution, but it doesn't seem to work on class name components, like 'foo' in '.foo-bar'.
Any suggestions?