Exporting Javascript and CSS for Wordpress #29427
Unanswered
twalkerspire
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
tldr: I basically want to run a command and have storybook/webpack generate and export minified css and js versions that I can use outside of storybook on any site by just added the css and js. So it would just be two files, a css and js file, that I can give to backend developer and they can add it to the site and be able to use the js and css from storybook.
Is this possible? if so, how?
Hello all,
I am currently using storybook as a component library for wordpress.
What I am trying to do is create a "build" that will allow webpack to bundle up the CSS and JS and place it in a ./dist folder where we can grab the css and js to enqueue into wordpress.
I've figured out a webpack config that generates minified versions of the css and js but the issue is that the JS but the issue is that the javascript is never being run when it is added on the wordpress site.
I've also done some experimenting with standalone sites and i run into the same issue where the JS is never being ran.
I am wondering am i doing anything wrong?
Additional information
`/** @type { import('@storybook/html-webpack5').StorybookConfig } */
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const RemovePlugin = require('remove-files-webpack-plugin')
const StylelintPlugin = require('stylelint-webpack-plugin')
const { resolve, join } = require('path')
const config = {
stories: [
'../src/_stories/Welcome.mdx',
'../src/_stories//*.mdx',
'../src/_stories//*.stories.@(js|jsx|mjs|ts|tsx)',
],
}
export default config
`
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions