Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nano-css #164

Open
streamich opened this issue Mar 19, 2018 · 10 comments
Open

nano-css #164

streamich opened this issue Mar 19, 2018 · 10 comments

Comments

@streamich
Copy link

What are your thoughts on adding nano-css? I could possibly submit a PR.

@DSchau
Copy link
Owner

DSchau commented Mar 19, 2018 via email

@DSchau
Copy link
Owner

DSchau commented Mar 19, 2018

@streamich I attempted to add this dependency, but I'm running into some issues with some addons, specifically addonKeyframes (import {addon as addonKeyframes} from 'nano-css/addon/keyframes').

I receive the following error in my console:

Error: Addon "keyframes" is missing the following dependencies:
 require("nano-css/addon/putRaw").addon(renderer);
 require("nano-css/addon/put").addon(renderer);

neither of those files exist in the node_modules/nano-css/addon directory.

@streamich
Copy link
Author

streamich commented Mar 19, 2018

put and putRaw addons are set on nano instance automatically. Can you please share the code where you apply the keyframes addon?

It should be something like this:

import {create} from 'nano-css';
import {addon as addonKeyframes} from 'nano-css/addon/keyframes';

const nano = create();

addonKeyframes(nano);

@DSchau
Copy link
Owner

DSchau commented Mar 19, 2018

Hmm... you're right! I just copied the code from https://github.com/streamich/nano-css/blob/HEAD/docs/Installation.md, so it must be something with my setup.

Will investigate! Here's a CodeSandbox demonstrating that the issue does not occur.

@streamich
Copy link
Author

Any luck?

@DSchau
Copy link
Owner

DSchau commented Mar 20, 2018

Hi! Sort of...

So nano-css does things a bit differently than most other libraries, and seems to be basically require a helper file (that adds all the addons to the nano instance).

Unfortunately, how CSS in JS Playground works is that it basically mimics local imports, and doesn't have full support for import/export so it's a bug fix I'll have to make to support it.

Shouldn't take me too much longer.

@streamich
Copy link
Author

streamich commented Mar 20, 2018

You could use my in-memory file system to hold files memfs; and then you would have to implement your custom require function. That would basically mimic NodeJS environment.

@DSchau
Copy link
Owner

DSchau commented Mar 20, 2018

Would that work in the browser.. ?

@DSchau
Copy link
Owner

DSchau commented Mar 20, 2018

Yes it will 🙃

So basically I've done something semi-similar, I use URL encoded params to hold the data and replace export default with a new Function() that returns. So I can get this working one way or another!

@streamich
Copy link
Author

streamich commented Mar 20, 2018

Well then just keep it your way. But if you will use an in-memory file system, you will need to write your own require function, which is module module in Nodejs. I have done that, long time ago, this is what it looked like: https://github.com/streamich/portable-bundle-browser-micro/tree/master/lib

But that's I guess too complex fo this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants