Page MenuHomeSealhub

Add importing styles and script as plain text to use it with JSX
Open, NormalPublic1 Points

Description

Now when we are using JSX syntax in sealgen we can sometimes find ourselves doing stuff like this

return (<div>{`<script>console.log("XD")</script>`}</div>);

or

return (<div>{`<style>.cmp-something { opacity: 0; }</style>`}</div>);

While we can in most case go around that with using stimulus or creating css in external files and only using class name in JSX it would be nice to add something more straightforward for simpler cases. for example

import customStyles from "./index.css";
import customScript from "./index.js";

// ...

return (<div>{customScript}{customStyles}</div>);

Its gonna be more readeable and and we will get proper syntax support while using external files.

The problem is we cant do what i just presented because imports in our projects already have .js extension. This task is about coming up with an idea how to solve this issue and implement that.

Details

Coded by
JayNecessary
Action required from
FilipI

Revisions and Commits

Event Timeline

kuba-orlik set the point value for this task to 1.
kuba-orlik subscribed.

Pricing it provisionally. If it turns out that some esbuild dev work is needed, like writing an involved custom plugin, we will increase the price of this task

kuba-orlik updated the task description. (Show Details)
kuba-orlik updated the task description. (Show Details)
jenkins-user updated Action required from, added: JayNecessary.

I'm currently working on implementing query parameters which should solve that problem. So far that is only idea i came up with as i think special file extensions won't be as clean.

JayNecessary added a revision: Restricted Differential Revision.Fri, Nov 14, 12:31
jenkins-user moved this task from Doing to Review on the Kanban board.
jenkins-user updated Action required from, added: FilipI; removed: JayNecessary.