guybedford / require-css

A RequireJS CSS loader plugin to allow CSS requires and optimization
MIT License
982 stars 365 forks source link

having trouble specifying path of css to load #230

Open funkyvisions opened 7 years ago

funkyvisions commented 7 years ago

This could totally be my misunderstanding of how to use this library, but I'm trying to use it the same way I used

https://github.com/requirejs/text

There I did the following:

define(["text!./util/inappbrowser.js", function(js) {});

The target file was relative to the baseUrl path (js) in my require.config. The resultant path is

http://localhost:8000/js/util/inappbrowser.js

I'm trying to do the same thing with this.

define(["css!../views/snippets-shared/pull-list-item"]

however the path it tries to load from comes out as

http://localhost:8000/views/views/views/views/snippets-shared/pull-list-item.css

The only way I can get this to work is to specify the path of

../../../../views/snippets-shared/pull-list-item

Is this enough info to help me diagnose what is going on?

guybedford commented 7 years ago

Sure, SystemJS swaps the plugin system around - define(["./views/snippets-shared/pull-list-item.css!css"]. If you prefer RequireJS style you can use System.config({ pluginFirst: true }).