Giter Site home page Giter Site logo

css: CSS Media Query Support about templ HOT 10 OPEN

wedow avatar wedow commented on June 18, 2024 5
css: CSS Media Query Support

from templ.

Comments (10)

a-h avatar a-h commented on June 18, 2024 2

I have a proof-of-concept started that uses the tdewolff CSS parser as a base, and layers in some additional parsing for Go expressions.

The idea would be to use standard <style> tags, but support {{ go.variable }} within values. I've got a few tests here - https://github.com/a-h/templ-css/blob/main/parse_test.go - obviously, the test suite would need to be massively widened out.

Note that most are of type CSSToken, but then there's also a few of type GoToken, which is where the variables are inserted. At the moment, there's no concept of property name to property value, which is what the CSS sanitization uses to determine what (if any) sanitization to support.

Before I jump to anything, the plan is to have an online meeting where everyone that's interested in templ CSS development can get together kick around ideas, and hopefully build consensus on a direction.

from templ.

headblockhead avatar headblockhead commented on June 18, 2024 1

@joerdav Feel free to make a PR, I havenโ€™t been able to start on adding media queries yet, maybe I was a bit too eager with my comment(!)

from templ.

joerdav avatar joerdav commented on June 18, 2024 1

@nftbolt not yet. For now I'd recommend using <style> tags in your template, or css files.

from templ.

joerdav avatar joerdav commented on June 18, 2024

Currently no there isn't a good way to accomplish this, definitely a good feature for us to have though!

from templ.

headblockhead avatar headblockhead commented on June 18, 2024

Hello! Might attempt to add this in a PR.

from templ.

joerdav avatar joerdav commented on June 18, 2024

Hi @headblockhead, I was thinking of picking this one up this week, are you still thinking of PRing for this one? Don't want to duplicate work if you're almost there with it!

from templ.

joerdav avatar joerdav commented on June 18, 2024

Started work here: https://github.com/joerdav/templ/tree/media-queries

from templ.

joerdav avatar joerdav commented on June 18, 2024

Figured it would be worth discussing the design of it before I go ahead and implement the generator.

from templ.

joerdav avatar joerdav commented on June 18, 2024

So far the generator side of this has been more complex than expected, I'm thinking of parking for now since there is bigger fish to fry! And this can be worked around at the moment by just using a normal old style tag rather than templ css.

from templ.

nftbolt avatar nftbolt commented on June 18, 2024

Any update on this?

from templ.

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.