trgkanki / cloze_hide_all

GNU Affero General Public License v3.0
11 stars 3 forks source link

minify css less aggressively #43

Closed ijgnd closed 3 years ago

ijgnd commented 3 years ago

This is not a bug - it's a bad interaction between two add-ons that could be fixed on either side though I think changing "Cloze Hide All" might make more sense.

I tested with the add-on "Cloze Hide All" and Custom Styles (font color, background colour, classes) in Anki 2.1.35.

My "Custom Styles" add-on offers to insert @import url("_editor_button_styles.css"); into the styling section of each note type, see here. On startup my add-on checks if this string is still present and if it's missing offers to update the note tpye.

In "Clozde Hide All" I have set "noModelMigration": false. This means that the css is minified which among other things removes quotes inside url(), see this line. This modifies the string my add-on inserted so that on the next restart it doesn't find the string and now offers to update the cloze hide all notetype.

I know that this can be avoided by setting noModelMigration to true (as you recommend it). But some people might not do this. I could update my add-on so that it checks if not (quoted_line in model['css'] or unquoted_line in model['css']): which should resolve the problem.

But in the future there might be other add-ons that update each styling section with a link to an external file and as far as I see quotes in url() are more common than the unquoted version even though both are valid css, see here.

So maybe your line could be removed? I think that this doesn't bloat the css too much. Or did I miss another indended effect of removing quotes from url()? Naturally this is is just a minor problem.

If you don't like the idea just close the issue and I'll modify my add-on.

 

And a general point: Thanks for creating, sharing and maintaining this great add-on.

phu54321 commented 3 years ago

OK. I'll look into this