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

Already on GitHub? Sign in to your account

URL Rewrites #32

Closed
gabrielhart opened this Issue Jun 4, 2012 · 4 comments

Comments

Projects
None yet
2 participants

Hi Pete,
Excellent work.

I am having a problem with URL rewrites. The settings that I am using are all working except for the rewrites (dollar are vars coming from _GET, and working ok).

$options = array(
'debug' => $debug,
'boilerplate' => $boilerplate,
'cache' => $cache,
'versioning' => $versioning,
'rewrite_import_urls' => true
);

$compiled_file = csscrush::file($filepath, $options);

For test purposes I put the 'rewrite_import_urls' in as a direct value.

Any advice appreciated or I can send you a sample. Currently the setup is:

/rootui
/theme/themefile.css (this file references images below as "../media/image/.")
/media/image/.
/site/mysite/stylesheet.css (inside, this references themefile.css as @import(../../themefile.css)
(after) /style/site/stylesheet.crush.css (references themefile.css as (../media/image/.)

In the crush file, the correct path to be generated in the crushed file (/style/site/stylesheet.crush.css) should be (../../media/image/) in order to continue to have a valid references for the original files, but it remains (../media/image/.).

I hacked the code a bit but cannot resolve...

Any help appreciated.
G

PS: Option for url rewrite without conversion of images to data would be great too...

@peteboere peteboere added a commit that referenced this issue Jun 5, 2012

@peteboere peteboere Resolved issue #32 9affb10
Owner

peteboere commented Jun 5, 2012

Hi Gabriel, thanks for your input!

I've tracked this down, seems there was a regression during recent refactoring.

Just checked in a fix to the test branch if you'd like to pull that down and try it.

Thank you Pete! Will do-my gang and I love this tool and it's a real help. 

Cheers!
Gabriel


From: Pete Boere reply@reply.github.com
To: gabrielhart gabriel.hart@rocketmail.com
Sent: Tuesday, June 5, 2012 10:03 AM
Subject: Re: [css-crush] URL Rewrites (#32)

Hi Gabriel, thanks for your input!

I've tracked this down, seems there was a regression during recent refactoring.

Just checked in a fix to the test branch if you'd like to pull that down and try it.


Reply to this email directly or view it on GitHub:
#32 (comment)

Hi,
So its not working perfectly yet, but I created some test cases for you to see. The piece of code that writes the path seems to have a little glitch in it.

Examples:
Inside the Stylesheet -> /ui/site/test/styleheet.css:
@import url( "../../theme/small-icons.css" ); /* path is /ui/theme/ - global stuff /
@import url( "theme/large-icons.css" ); /
path is /ui/site/test/theme/ - local stuff */

Original CSS in imported css files (pointing to different but same named folders):
.sm-icon-add { background-image: url( ../media/image/icon/add.png ); }

.large-icon-1 { background-image: url( ../media/image/icon/large/applications-internet.png ); }
(found in

Post-crush output:
.sm-icon-add { background-image: url(../../theme/../media/image/icon/add.png); }
.large-icon-1 { background-image: url(theme/../media/image/icon/large/applications-internet.png); }

The correct conversions should be:
.sm-icon-add { background-image: url(../../media/image/icon/add.png) }
// so it points to the common folder up there
.large-icon-1 { background-image: url(media/image/icon/large/applications-internet.png); }
// so it points to a more local folder

This kind of facility to get the paths right is so important-looking forward to a resolution. Happy to test further to get things working well. Hope this feedback is helpful.

Cheers!
Gabriel

Owner

peteboere commented Jun 6, 2012

I've tried to recreate your test case as follows:

└── ui
    ├── site
    │   └── test
    │       ├── stylesheet.css
    │       └── theme
    │           ├── large-icons.css
    │           └── media
    │               └── image
    │                   └── icon
    │                       └── large
    │                           └── applications-internet.png
    └── theme
        ├── media
        │   └── image
        │       └── icon
        │           └── add.png
        └── small-icons.css

If this is the case then these paths in your test case:

.sm-icon-add { background-image: url( ../media/image/icon/add.png ); }

.large-icon-1 { background-image: url( ../media/image/icon/large/applications-internet.png ); }

Should be (without ../ prefix):

.sm-icon-add { background-image: url( media/image/icon/add.png ); }

.large-icon-1 { background-image: url( media/image/icon/large/applications-internet.png ); }

If this is not right can you send a zip of your test case to pete at the-echoplex.net please

@peteboere peteboere closed this Jun 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment