indexiatech / re-notif

Redux & React based Notifications center.
http://indexiatech.github.io/re-notif
BSD 3-Clause "New" or "Revised" License
148 stars 45 forks source link

separate CSS import from Notifs.js #36

Closed jpollard-cs closed 7 years ago

jpollard-cs commented 8 years ago

Just wanted to open this to discussion .. the way CSS is now being imported in Notifs.js may be a breaking change for some users who have not yet upgraded from the re-notif version of the npm package (especially for tests). Excluding this import in Notifs.js would require a separate imports/requires by redux-notifications package users (and therefore would be a breaking change for anyone who has already upgraded), but would also make the redux-notifications package easier to use in universal/isomorphic applications. Thoughts?

Also for anyone who does have breaking tests after upgrading from re-notif to redux-notifications and your error message looks something like SyntaxError: Unexpected token ., assuming you're using babel-register with a test setup script you can try adding the following to your setup script:

// you'll probably already have this part
require('babel-register')({
    ignore: /node_modules/
});

// this is what you want to add
require.extensions['.css'] = () => {
    return;
};
reharik commented 8 years ago

I concur I have to go in and delete the require of the css everytime I rebuild my dependencies. r

kylecesmat commented 8 years ago

@jpollard-cs what would be a better method to import the styles? I suppose we could make the imports optional and include them in the component exports?

So users could do import { Notifs, styles } from 'redux-notifications'? or we could inline the base styles? Include no styles by default?

reharik commented 8 years ago

Hi, I'm in favor of letting the consumer handle the css however they wish but providing them with an implementation. So that would be the import { Notifs, styles }. That would make my life a bit easier. Thanks, r

kylecesmat commented 7 years ago

Fixed in v3.0.0

jpollard-cs commented 7 years ago

@kylecesmat sorry just seeing your comments above, but yes I believe that was the best approach 👍