Skip to content

refactor: optimise code and config for new pug-plugin #2

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

Open
wants to merge 1 commit into
base: public
Choose a base branch
from

Conversation

webdiscus
Copy link

Hello @MetaLamp school,

I'm the author of the pug-plugin that many of your students are incorrectly setting up in the Webpack of the learn project named as MetaLamp or Toxin. These projects are cloned from frontend-intership-toxin.

I will demonstrate how to correct configure the Webpack and use the pug-plugin.

Using pug-plugin the compilation is 3x faster:

  • pug-plugin only 3 sec
  • html-webpack-plugin + mini-css-extract-plugin + pug-loader > 9 sec

Compiling Pug with pug-plugin is much easy than with "old way" using the html-webpack-plugin.

Just one Pug plugin replaces the functionality of many plugins and loaders used with Pug:

Using the pug-plugin:

  • the Webpack entry-point is the Pug file, not JS-file
  • all source scripts (JS/TS) should be specified directly in Pug, in script tag, not in Webpack entry
  • all source styles (CSS/SASS/SCSS) can be specified directly in Pug, in link tag, or imported in JS
  • compiling is faster

You can clone & try the updated version from my fork:

git clone https://github.com/webdiscus/frontend-intership-toxin.git
cd frontend-intership-toxin
git checkout new-pug-plugin

npm i -f
npm start

P.S. for any question I will help you

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

Successfully merging this pull request may close these issues.

1 participant