Giter Site home page Giter Site logo

Comments (7)

cyberdelia avatar cyberdelia commented on August 22, 2024

I can't reproduce your error, see and try branch fix-relpath. Can you explain me what exactly what broke ? It's maybe in another part of pipeline, I suspect absolute_path.

from django-pipeline.

cnorthwood avatar cnorthwood commented on August 22, 2024

I've tried that branch, however the error still occurs. The problem appears to be that the URLs to the compressed CSS are generated wrong - when I add the / to the end of my STATIC_ROOT, they appear correctly as /static/favourites/css/smart.css, but without, the path is just:

from django-pipeline.

cnorthwood avatar cnorthwood commented on August 22, 2024

Yes, the probably does appear to be in absolute_path. If on line 198 here: https://github.com/cyberdelia/django-pipeline/blob/master/pipeline/compressors/__init__.py#L198 I change it to:

path = os.path.join(start, path)

(i.e., get rid of the os.path.dirname), then it works. I don't know if that has any side effects

from django-pipeline.

cyberdelia avatar cyberdelia commented on August 22, 2024

Can you help me with more detail on how to reproduce (settings, original url, incorrect and correct result url) ? I want to add a regression test for this bug. You can also try to write the test by yourself, if it's easier for you ;)

from django-pipeline.

cnorthwood avatar cnorthwood commented on August 22, 2024

If you change line 21 here: https://github.com/cyberdelia/django-pipeline/blob/master/tests/runtests.py#L21 to get rid of the / on the end of the STATIC_ROOT setting (which is similar to how my STATIC_ROOT is defined, without the /), then your tests will fail

from django-pipeline.

cgreene avatar cgreene commented on August 22, 2024

I have been digging into this a bit. I can confirm that @cnorthwood's suggestion, "(i.e., get rid of the os.path.dirname), then it works," does in fact have side effects. Anything with a relative URL (i.e. image resources defined in the css) get the wrong path (the path includes the css path in the image location).

I think the correct fix is to take @cnorthwood's suggestion and then to also change
public_path = self.absolute_path(asset_path, css_path)
to
public_path = self.absolute_path(asset_path, os.path.dirname(css_path))
in construct_asset_path.

I can set up a pull request for this, I guess. This is the fix that we're now using locally.

from django-pipeline.

cyberdelia avatar cyberdelia commented on August 22, 2024

@cgreene We had the same finding at the same time, it's in the fix-relpath branch, that will be merged soon in master and released.
@cnorthwood Thanks for the report and the help to make it reproducible.

from django-pipeline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.