zyrolasting / polyglot

Create websites using any mix of programming languages or workflows 💎
MIT License
77 stars 2 forks source link

Dependency discovery for CSS url() #29

Closed xy2i closed 4 years ago

xy2i commented 4 years ago

I had trouble with including external assets in CSS. From my understanding, polyglot does not do dependency discovery in css files. This can be annoying for a couple of reasons:

@font-face {
  font-family: 'myfont';
  src: url('myfont.woff2');
}

You can work around these by putting them somewhere static, but then the static contents (images, fonts) aren't cache busted when changed, like polyglot does for every asset, and it adds an extra step - I feel it is a bit of a hack.

zyrolasting commented 4 years ago

I'll have something for you ASAP.

zyrolasting commented 4 years ago

@xy2iii PR up. This is a good addition to the base workflow.

I'm assuming you've reviewed this section already, but anyone reading this comment should create a new workflow if they need an asset processed differently. The built-in workflows still don't do dependency discovery in JavaScript modules, but you can add it without waiting on me.

Also, have you considered Racket module dependency handling? I used this technique along with css-expr for my site, since it gave me nested selectors and kept all of Racket available when styling.