aramk/CSSJSON

Suggested improvement

CliffCrerar opened this issue · 0 comments

Hi,

Your instructions are straightforward on how it works, and based on how the rest of the NPM world works I assumed the import was as usual:

const CSSJSON = require('css-to-json')

So kept getting errors in my code and could not figure out why, so I looked inside the object CSSJSON.

To my surprise the I found {} inside the CSSJSON.

This is because your package has no index.js file so I either had to const CSSJSON = require('css-to-json/cssjson') or manually create a index.js in your package, import the object and export it again so I could just call const CSSJSON = require('css-to-json').

OR

In your instructions maybe just add const CSSJSON = require('css-to-json/cssjson') to the top of the examples to show the import for developers who have moved on from manually placing inline scripts.

It will avoid a lot of annoying comments just like this one and save you some pain as well as other devs using your clever package some time in troubleshooting.

Just a hint. Use it or don't.