-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extra types of sections #44
Comments
+1 A general purpose system would be great here. |
Yes, it is possible. |
@MunGell Setting up custom loaders doesn't make it obvious how you would have a |
I see, you want to have multiple tags with various purposes. |
I've never used jest, but couldn't you just make up a mime type, then tell one-loader to extract that and use some file-loader or something to put it into a jest file? My guess would be that you can just make up |
I think you are right, technically nothing stops us from having component file like that: <script type="application/typescript">
class MyComponent extends Component {}
</script>
<style type="text/css">
.MyComponent {}
</style>
<script type="application/x-jest">
describe('', () => {})
</script> in {
plugins: [
new ExtractTextPlugin("tests.js"),
]
...
map: {
"text/css": ["css-loader", "style-loader"],
"application/typescript": "babel-loader",
"application/x-jest": ExtractTextPlugin.extract(/*optional: "babel-loader"*/)
}
...
} and then run I didn't test this code, but opinions are welcome! |
Ok, turns out it won't work. You'll get:
or when using 2 style tags:
@MunGell is there a particular reason why it's limited to 1 tag per type? |
thinking about it, it might actually be good to add one more tag that is generic for template or descriptive stuff. Don't get me wrong, I still think we need to fix the problem that only So a
Having a generic |
@Zauberfisch I remember I had to put that warning in place due to some technical issue that multiple tags were bringing, will need to have another look. On the extra tag - this should be a fairly quick fix, would you be interested in creating a PR for that? |
@MunGell I took a quick look at it, but I realised I currently don't have the time to do some proper work that is not just a quick hack. So I'm afraid I won't be able to make a PR anytime soon. But I'll probably come and revisit this at some later point if it hasn't been done by then. |
No worries at all, I will keep this issue open for anyone to pick up, unless I will have time to implement it myself. |
Is there any way to add extra types of sections (in addition to 'script' and 'style').
I would very much like to have a 'jest'-section for unit tests and a 'storybook'-section for Storybook stories.
The text was updated successfully, but these errors were encountered: