Replies: 5 comments 2 replies
-
In vite 4.0, they support import css as string by add inline in suffix https://vitejs.dev/blog/announcing-vite4.html#importing-css-as-a-string |
Beta Was this translation helpful? Give feedback.
-
Our team is using import style from './style?inline'
@customElement('xxx)
export class XXX extends LitElement {
static styles = css`
${unsafeCSS(style)}
/* to make it at the center of the container */
.affine-shape-block-g {
transform: translate(${SHAPE_PADDING / 2}px, ${SHAPE_PADDING / 2}px);
}
`;
// ...
} in vite, it works well. But not in next.js |
Beta Was this translation helpful? Give feedback.
-
Any news on this? |
Beta Was this translation helpful? Give feedback.
-
I think that I was able to use the import style from '!!raw-loader!./style'; I had to install
https://stackoverflow.com/a/49235967 May be a suitable workaround for some. I had an issue with CSP where I had to hash some inlined styles in order to mark them as safe. Not sure if this approach is workable towards that end due to processing done by Next which may lead to changes in style tag's content which in turn change the generated hash. |
Beta Was this translation helpful? Give feedback.
-
Any news on this? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
Describe the solution you'd like
if CSS file ends with 'inline,' treat it as a raw data
Describe alternatives you've considered
Use
raw-loader
into the webpack config, but it won't work as expectedBeta Was this translation helpful? Give feedback.
All reactions