peterbe / premailer

Turns CSS blocks into style attributes
https://premailer.io
BSD 3-Clause "New" or "Revised" License
1.06k stars 188 forks source link

The defaults are different in __main__ #220

Open peterbe opened 5 years ago

peterbe commented 5 years ago

You get different output run you run:

$ python -m premailer -f /tmp/foo.html

...compared to...

with open('/tmp/foo.html') as f:
    html = f.read()
print(premailer.transform(html))

Seems the defaults in __main__ are probably different from those in the Premailer class's __init__

Not sure which or how it compares to the README but they should all ideally be the same.

peterbe commented 5 years ago

I think it only manifests itself with certain more advanced features/options. Here's the /tmp/foo.html example: https://gist.github.com/peterbe/51f687adf87cf294080d6b0596992966

peterbe commented 5 years ago

The point is, the __init__ method has a long list of options/settings. Some are True and some are False. (Just focussing on the booleans).

When using argparse it doesn't make sense to use default=True on any of them because your only choice is to not type the argument or type it.

Ideally, ALL options (everywhere) should be False by default. For things that are currently True by default, they'd need to be rewritten. For example exclude_psueduoclasses=True would need to be rewritten to include_pseudoclasses=False.