Giter Club home page Giter Club logo

Comments (5)

ojii avatar ojii commented on May 19, 2024

Would a thing like postprocessor <path> for addtoblock solve this? That postprocessor could translate the paths.

from django-sekizai.

jrief avatar jrief commented on May 19, 2024

Yes, that's exactly the thing I was thinking about.
However, I would name it preprocessor, but that's a question of taste.

Something else to consider: How shall the mapping rule be defined?
We could write
{% addtoblock "css" %}<link href="{% static %}css/my-style.scss" rel="stylesheet" type="text/x-scss" />{% endaddtoblock %}
and use text/x-scss as the key for applying a rule, or we could write
{% addtoblock "scss" %}<link href="{% static %}css/my-style.scss" rel="stylesheet" type="text/css" />{% endaddtoblock %}
and use scss as the key for applying a rule.

One of the advantages I see using the latter proposal, is to convert files found in directory bower_compontents directly into the Google's CDN counterpart. Today, I used the package https://github.com/sindresorhus/gulp-google-cdn and it does a perfect job. This means that with Sekizai, then we could convert external dependencies managed by bower from a local include to a CDN include.

from django-sekizai.

ojii avatar ojii commented on May 19, 2024

Yes, that's exactly the thing I was thinking about.
However, I would name it preprocessor, but that's a question of taste.

Great, I'll add that then.

Something else to consider: How shall the mapping rule be defined?
We could write
{% addtoblock "css" %}{% endaddtoblock %}
and use text/x-scss as the key for applying a rule, or we could write
{% addtoblock "scss" %}{% endaddtoblock %}
and use scss as the key for applying a rule.

As with the render_block postprocessor, I won't actually implement any pre/post-processors in sekizai, so this is really up to the implementation.

from django-sekizai.

ojii avatar ojii commented on May 19, 2024

Upgrade sekizai to 0.8.1 or higher to get preprocessor in addtoblock.

from django-sekizai.

jrief avatar jrief commented on May 19, 2024

As with the render_block postprocessor, I won't actually implement any pre/post-processors in sekizai, so this is really up to the implementation.

Sure, that's much better. And it keeps the template tags symmetrical! Use postprocessor in {% render_block ... %} and preprocessor in {% addtoblock ... %}.

from django-sekizai.

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.