Code Monkey home page Code Monkey logo

Comments (11)

tj avatar tj commented on August 15, 2024

yeah that works, I think this part will be pretty ad-hoc, what we do is loop through out component.json files, grab the filenames and set up matching routes with express and res.sendfile(), definitely more than one way to solve this portion

from component.

timoxley avatar timoxley commented on August 15, 2024

Can either of you give any guidance on a decent way to handle this? I'm doing stupid stuff like this in my makefile:

release: replace
    @component build

replace:
  @cat ./css/font-awesome.css | sed -e 's/\.\.\/font\//..\/components\/timoxley-font-awesome\/font\//g' > ./release/font-awesome.css

This, seems wrong.

Related tickets: #28, #11

from component.

tj avatar tj commented on August 15, 2024

I originally created rework for the css manip stuff, I'll try out a few things at least as reasonable defaults. This does get a bit more complicated depending on how you use components

from component.

timoxley avatar timoxley commented on August 15, 2024

@visionmedia I'll have a look into rework. If you couldn't tell, the use case here is an icon-font component. I was thinking about perhaps having the component inject the css into the dom so it could manipulate the paths dynamically… but then you lose cachability. Perhaps something along those lines might work.

from component.

tj avatar tj commented on August 15, 2024

even a simple regexp would do we dont really need rework for that part but i had other things in mind for the future. just need to figure out the least leaky abstraction possible for this

from component.

tj avatar tj commented on August 15, 2024

by default in --dev this will prefix urls with ./ so that they work with file://, and without --dev they will not be prefix so you'll end up with urls like /my-component/images/maru.png, and I added --prefix url for cases like /public/my-component/images/maru.png depending on your serving technique

from component.

timoxley avatar timoxley commented on August 15, 2024

πŸ‘ πŸ‘

from component.

jonathanong avatar jonathanong commented on August 15, 2024

how can we disable URL rewriting for CSS? I prefer to handle all static assets myself since they're all going into a CDN.

from component.

tj avatar tj commented on August 15, 2024

well you wont want to PUT the data to a cdn each time you change something in dev, that would be a separate build when you're deploying. if you disable url rewriting with component they simply wont point to the correct files, but nothing else changes

from component.

jonathanong avatar jonathanong commented on August 15, 2024

Oh of course not. My question is just how to disable url rewriting so /images/image.png doesn't become /mycomponent/images/image.png when building. I don't see any options anywhere.

from component.

shaw-bluezinc avatar shaw-bluezinc commented on August 15, 2024

@timoxley @visionmedia

Finding that building a component referencing FontAwesome on windows is causing a problem which I think relates to this.

The result is:

 @font-face {
   font-family: "FontAwesome";
   src: url("\timoxley-font-awesome\font\fontawesome-webfont.eot");
   src: url("\timoxley-font-awesome\font\fontawesome-webfont.eot?#iefix") format('eot'), url("\timoxley-font-awesome\font\fontawesome-webfont.woff") format('woff'), url("\timoxley-font-awesome\font\fontawesome-webfont.ttf") format('truetype'), url("\timoxley-font-awesome\font\fontawesome-webfont.svg#FontAwesome") format('svg');
   font-weight: normal;
   font-style: normal;
 }

Note that \t is a tab character so the escaping isn't working right, however, even so, I'm not convinced a backslash for a css url is ever appropriate - even on windows?

Thanks

from component.

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.