geelen / jspm-loader-css

50 stars 27 forks source link

working with SystemJS 0.18.x #16

Closed wprater closed 9 years ago

wprater commented 9 years ago

I seem to be having issues with the plugin on SystemJS 0.18.x. seems like it's trying to process it as JS and never gets to the fetch call.

rbvea commented 9 years ago

:+1:

gonzochic commented 9 years ago

same here

chenxsan commented 9 years ago

I think this problem was caused by SystemJS code change here, @wprater 's commit https://github.com/geelen/jspm-loader-css/pull/18 could solve half the problem, the path would still be a undefined. But we might extract it from load.address?

chenxsan commented 9 years ago

Just created some demo codes here based on wprater's commit, works fine on my project as far as i can see.

wprater commented 9 years ago

@chenxsan thanks, perhaps this is better. was this for an error with the builder?

chenxsan commented 9 years ago

@wprater Oops, it would cause an error when building with jspm, guess there are better ways to do it.

wprater commented 9 years ago

@chenxsan did you check my updated PR?

chenxsan commented 9 years ago

@wprater Just checked it, it would export css class like "_http_127_0_0_1_9999_style_app__standout" if I had

:local(.standout) {} 

in my app.css file. That _http_127_0_0_1_9999 part is needless.

wprater commented 9 years ago

Ive never tried the modules feature. is this another issue, or something related to the path still? Im not sure I understand.

chenxsan commented 9 years ago

If I had

:local(.standout){}

in style/app.css, jspm-loader-css would produce a css class ._style_app__standout, so your updated PR is ok, but that host part like _http_127_0_0_1_9999 is redundant(I'm running the project in http://127.0.0.1:9999 with jspm-server), maybe @geelen can explain it better :).

f15gdsy commented 9 years ago

Hi, any updates on this issue?

Hypercubed commented 9 years ago

@wprater Your patch-1 worked with :local(.lol) becoming _http_localhost_8080_src_main__lol but fails if I include composes: with the error Uncaught (in promise) Error: Cannot read property 'push' of undefined(…). Not sure if that is a separate issue.

f15gdsy commented 9 years ago

Hi @wprater, I tried your fix, it works well using System.import. But when building using 'bundle-sfx', the css is not present in the code though classes are set correctly for html tag. I'm not sure why but do you have a fix for it? Thanks!

f15gdsy commented 9 years ago

Based on @wprater 's pull request, I made it work in bundle mode too. Here is my pull request. It works for me when using 'bundle-sfx' to bundle the code.

MeoMix commented 9 years ago

This still seems to be broken even with the PR? Is there something special that needs to happen?

f15gdsy commented 9 years ago

@MeoMix which PR are you using? What's the error you got?

MeoMix commented 9 years ago

@f15gdsy It seems to have fixed itself this morning after updating to the latest version of JSPM. Not sure if that's related at all, but I am successfully loading CSS now. :+1:

EDIT:

Oh, it was because I was overriding css.js and didn't update that with the PR changes. I'm now doing:

import { CSSLoader, Plugins, fetch, bundle } from 'jspm-loader-css';

console.log('Plugins:', Plugins);

const loader = new CSSLoader([
    Plugins.autoprefixer()
], __moduleName);

export default loader;
export { CSSLoader, Plugins, fetch, bundle };
geelen commented 9 years ago

Working on a new release to fix all these breakages. Will be a new major version, building on @douglasduteil's work. First PR merged in here: https://github.com/geelen/jspm-loader-css/pull/23