-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
How to add a <script> tag? #163
Comments
Yes, there is, but I don't think there's any docs on it yet. See #77. Basically, create a Note: This will add it to |
Thanks! |
updating the answer: add a |
There doesn't seem to be a way to do this for local dependencies. What's the best way to get these into stories & the build output? <script nomodule src="/dist/my-custom-script.js"></script>
|
You can find the doc on the official website at this address: https://storybook.js.org/docs/configurations/add-custom-head-tags/ |
Local dependencies can be copied over to the dist via the webpack copy plugin. This is how I loaded my local dependency; main.js const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
stories: ['../src/**/*.stories.ts'],
webpackFinal: config => {
config.plugins.push(
new CopyPlugin({
patterns: [{ from: './node_modules/@myorg/my-local-dep/dist', to: './my-local-dep-dist/' }],
})
);
return config;
},
}; preview-head.html <script async type="module" src="/my-local-dep-dist/my-script.esm.js"></script> |
Looking for a way to do this per story, not for all stories. |
react-prism recommends to add a script tag directly in the HTML:
Is there a way to do this?
The text was updated successfully, but these errors were encountered: