question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preview not working properly and had to manually include the css file for it to be bundled with webpack. Am I missing something?

See original GitHub issue

Describe your question Please describe your question in as much detail as possible.

Using webpack to bundle all my js and packages. Have to include css manually otherwise it is not working on the page. Also the preview is not working after all is imported? Am I doing something wrong or is there another prerequisite I don’t have?

admin.js


import $ from 'jquery';
import * as EasyMDE from 'easymde';
import 'easymde/dist/easymde.min.css';

var easyMDE = new EasyMDE({
    element: $("#postAdminContent")[0],
    forceSync: true,
    placeholder: "Write using markdown here. Content will be automatically translated to be presentable on your site.",
    renderingConfig: {
        codeSyntaxHighlighting: true,
    },
});

dependencies

  "dependencies": {
    "@babel/preset-env": "^7.13.15",
    "@tailwindcss/forms": "^0.2.1",
    "@tailwindcss/line-clamp": "^0.2.0",
    "autoprefixer": "^10.1.0",
    "babel-core": "^6.26.3",
    "babel-loader": "^8.2.2",
    "codemirror": "^5.60.0",
    "cross-env": "^7.0.3",
    "easymde": "^2.14.0",
    "jquery": "^3.6.0",
    "postcss": "^8.2.1",
    "postcss-cli": "^8.3.1",
    "postcss-import": "^14.0.0",
    "tailwindcss": "^2.0.2",
    "webpack": "^5.31.0",
    "webpack-dev-server": "^3.11.2",
    "zxcvbn": "^4.4.2"
  },
  "devDependencies": {
    "css-loader": "^5.2.0",
    "style-loader": "^2.0.0",
    "webpack-cli": "^4.6.0"
  }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
aaronducecommented, Apr 11, 2021

Sorted - it seems if you are using Tailwind, it conflicts as default styling is overridden in favour of utility classes.

To get around this, you would need to:

  • Install the Tailwind Typography plugin npm install @tailwindcss/typography
  • Add as a plugin to your tailwind.config.js file:
  plugins: [
    require('@tailwindcss/forms'),
    require('@tailwindcss/line-clamp'),
    require('@tailwindcss/typography'),
  ],
  • Wrap the textarea or target element for EasyMDE to use in a ‘prose’ element
<article class="prose max-w-none">
    <!-- textarea..... -->
</article>
0reactions
Ionarucommented, Apr 10, 2021

The preview window relies on the standard browser styling of elements, combined with whatever marked adds.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preview not working properly and had to manually include the css ...
Preview not working properly and had to manually include the css file for it to be bundled with webpack. Am I missing something?...
Read more >
Webpack not loading css - Stack Overflow
I ran Webpack with the --display-modules option, and verified that no css files display there. I have tried running it without the extract...
Read more >
Fixed regression: CSS entries were not picked up for storybook ...
Issue: CSS not displaying when using the exract-text-webpack-plugin , regression introduced in 38b9dfa. What I did. Upgraded from @kadira/storybook@1.x and ...
Read more >
Output Management - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Getting Started - webpack
Learn how to bundle a JavaScript application with webpack 5. ... or included in the wrong order, the application will not function properly....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found