shoonia / parcel-transformer-css-to-string Goto Github PK
View Code? Open in Web Editor NEWImporting CSS files as a string to JavaScript (Support Parcel v2)
License: MIT License
Importing CSS files as a string to JavaScript (Support Parcel v2)
License: MIT License
The plugin seems to work fine with parcel in watch mode. But when I try to run parcel build
, : get the following error:
parcel-transformer-css-to-string: true is not a PostCSS plugin
Error: true is not a PostCSS plugin
at Processor.normalize (\node_modules\postcss\lib\processor.js:145:15)
at new Processor (\node_modules\postcss\lib\processor.js:51:25)
at postcss (\node_modules\postcss\lib\postcss.js:73:10)
at Object.transform (\node_modules\parcel-transformer-css-to-string\dist\index.cjs:87:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Transformation.runTransformer (\node_modules\@parcel\core\lib\Transformation.js:653:5)
at async Transformation.runPipeline (\node_modules\@parcel\core\lib\Transformation.js:402:36)
at async Transformation.runPipelines (\node_modules\@parcel\core\lib\Transformation.js:265:40)
at async Transformation.runPipelines (\node_modules\@parcel\core\lib\Transformation.js:309:34)
at async Transformation.run (\node_modules\@parcel\core\lib\Transformation.js:183:21)
I'm not using PostCSS, or at least it's not configured to be used anyway. Is there a way to fix this?
I have the following css file that I want to inline:
@import 'npm:tippy.js/dist/tippy.css';
@import 'npm:tippy.js/themes/light.css';
.iframe-preview,
.wikipedia-preview {
width: 600px;
height: 500px;
border: none;
padding: 0.4em 2px 2px;
}
...
When processed by the plugin it becomes the following string:
exports.default = "@import 'npm:tippy.js/dist/tippy.css';\n@import 'npm:tippy.js/themes/light.css';\n\n.iframe-preview,\n.wikipedia-preview {\n\twidth: 600px;\n\theight: 500px;\n\tborder: none;\n\tpadding: 0.4em 2px 2px;\n}\n\n.tippy-content {\n\tpadding: 0;\n}\n\n.text-fragment-preview {\n\tpadding: 1px 0.5em;\n}\n";
Expected behavior: Imports are processed and the results are also inlined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.