Automattic / juice

Juice inlines CSS stylesheets into your HTML source.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't import juice via rollup

ProLoser opened this issue · comments

I'm having some difficulty importing juice via rollup for use in a browser application.

I've had errors about unresolved path to ./package which is when you import the package.json file, then I had to add a plugin to parse the json, then I ran into problems with the shebang from node_modules/datauri/index.js.

What is the preferred method of digesting this package for rollup and generating a browser-friendly version?

Had a similar problem with webpack. Used https://github.com/JavascriptIsMagic/shebang-loader for the specific module, i.e.

          {
            test: /\.js$/,
            include: path.resolve(__dirname, 'node_modules', 'datauri'),
            use: [require.resolve('shebang-loader')]
          }

I'm having the same problem with TypeScript, because require('./package') is not a valid TypeScript import. 😢

Is there any reason not to use require('./package.json')?