Skip to content
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

cssresources-addon: Do not use SyntaxHighlighter with the very long code-content. #9360

Merged
merged 1 commit into from
Jan 9, 2020

Conversation

tomilaurell
Copy link
Contributor

@tomilaurell tomilaurell commented Jan 8, 2020

Issue:

What I did

Adds support to use very long css content with cssresources-addon. The current implementation tries to render (forever) all the content with SyntaxHighlighter. This PR will restrict the use of SyntaxHighligher with content length up to 100k. In case the SyntaxHighligher is not used, the first 100k of the content will be rendered within plain pre-tag and warning of partly missing content is added to the end of it.

How to test

This is example with less-files.

webpack.config.js

...
// do not include style-loader to inject css content manually
config.module.rules.push({
    test: /\.less?$/,
    loaders: [require.resolve('css-loader'), require.resolve('less-loader')], 
  })
...

config.js

...
import globalStyles from '../styles/index.less'

cssresources: [
    {
      id: `Global toggleable styles`,
      code: `<style>${globalStyles}</style>`,
      picked: true,
    },
  ],
...

Screenshot

image

@vercel
Copy link

vercel bot commented Jan 8, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/79aefgspu
✅ Preview: https://monorepo-git-fork-tomilaurell-next.storybook.now.sh

@vercel vercel bot temporarily deployed to Preview January 8, 2020 19:31 Inactive
@tomilaurell tomilaurell changed the title Do not use SyntaxHighlighter with the very long code-content. cssresources-addon: Do not use SyntaxHighlighter with the very long code-content. Jan 8, 2020
@ndelangen
Copy link
Member

We use yarn in our repo, so if you could also please remove the package-lock.json?

@ndelangen ndelangen changed the base branch from next to next-6.0.0 January 8, 2020 21:31
@vercel vercel bot temporarily deployed to Preview January 9, 2020 08:36 Inactive
@ndelangen
Copy link
Member

beautiful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants