Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

CSS URL prefix option #52

Closed
Closed

Description

@guybedford

When bundling, URLs in CSS files are output as baseURL-relative. It can be worth having an option to set a custom prefix here - say System.clientBaseURL or something like that to inject during the build.

Perhaps the simplest is just to call it basePrefix?

Getting the name right is probably the hardest part.

Activity

  1. jamesgorrie commented on Jul 15, 2015

    @jamesgorrie

    Isn't it already applying the baseURL when clean-cssing? When testing it - it seems to, but the URL is still mismatched.

  2. guybedford commented on Jul 15, 2015

    @guybedford
    MemberAuthor

    Client and build baseURLs are separate things, so we need to take both into account for the final URL.

  3. jamesgorrie commented on Jul 15, 2015

    @jamesgorrie

    Ah, I see.

    As, while you're developing - the client baseURL is going to be used - surely it makes sense to keep them as one? Unless perhaps you wanted to have your prod environment use a different path to your dev, but it might be worth waiting for that use case?

    Do you think it'd be too coupled to just pass the baseURL through here as a default?

  4. guybedford commented on Jul 15, 2015

    @guybedford
    MemberAuthor

    The client baseURL is a browser URL relative to the browser public folder root. The server baseURL is a server path relative to the package.json to the same folder. Understanding that distinction is important to know how builds work - it should be better documented I know.

  5. theefer commented on Jul 21, 2015

    @theefer

    I have tried a variety of clean-css options but I can't seem to find a way to inject an absolute (or even relative) prefix to all image URLs. Docs seem to hint at using a combination of relativeTo and root but I can't seem to find the right combination...

  6. guybedford commented on Aug 24, 2015

    @guybedford
    MemberAuthor

    Ideally we should upgrade this plugin to use PostCSS. Help managing this plugin would be incredibly welcome.

  7. theefer commented on Aug 24, 2015

    @theefer

    Could you elaborate on what you see us use PostCSS for in this plugin? Just rebasing URLs to allow a prefix? Replacing some of the work clean-css does? Would it become more of a (hardcoded for now) post-processing pipeline?

  8. guybedford commented on Aug 25, 2015

    @guybedford
    MemberAuthor

    It seems like a better base project to use here than CleanCSS for providing more flexibility around the re-normalization of CSS process, and having the clean css process as a transformer on top of that. Then yes it does open the door to a processing pipeline as well, which would be nice to offer to users via meta-configuration of css transformers.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions