Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mincss gets confused by relative URLs #16

Open
ralsina opened this issue Jun 19, 2013 · 1 comment
Open

mincss gets confused by relative URLs #16

ralsina opened this issue Jun 19, 2013 · 1 comment

Comments

@ralsina
Copy link

ralsina commented Jun 19, 2013

I am trying to use mincss to create a CSS file containing the subset used by my site.
However, the same CSS file is linked by different pages using different relative links (../foo.css and ../../foo.css) which means mincss sees it as two different things.

I am using this script to try and analize what mincss can do:

import os
import sys

output_folder = os.path.abspath(sys.argv[1])
from mincss.processor import Processor
p = Processor()
urls = []
for root, dirs, files in os.walk(output_folder):
    for f in files:
        if not f.endswith('.html'):
            continue
        url = os.path.join(output_folder, root, f)
        urls.append(url)

p.process(*urls)
for inline in p.links:
    print "===>", inline.href, len(inline.before), len(inline.after)

And here is it's output:

===> ../../assets/css/bootstrap-responsive.min.css 16849 3251
===> ../assets/css/bootstrap-responsive.min.css 16849 3251
===> assets/css/bootstrap-responsive.min.css 16849 3251
===> ../../assets/css/bootstrap.min.css 106059 14737
===> ../assets/css/bootstrap.min.css 106059 14737
===> assets/css/bootstrap.min.css 106059 14737
===> ../../assets/css/code.css 3670 2114
===> ../assets/css/code.css 3670 2114
===> assets/css/code.css 3670 2114
===> ../../assets/css/colorbox.css 6457 774
===> ../assets/css/colorbox.css 6457 774
===> assets/css/colorbox.css 6457 774
===> ../../assets/css/rst.css 6559 2581
===> ../assets/css/rst.css 6559 2581
===> assets/css/rst.css 6559 2581
===> ../../assets/css/theme.css 1287 1061
===> ../assets/css/theme.css 1287 1061
===> assets/css/theme.css 1287 1061

It's perfectly possible that I am using mincss wrong, of course :-)

@kursusHC
Copy link

Apparently there is no support for multiple pages in mincss, which kind of negates the point of the tool in real life. What you see is probably the sum of every css linked in your pages, whatever they're duplicated or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants