benjaminpreiss / webpack_conf Goto Github PK
View Code? Open in Web Editor NEWA webpack configuration for webdevs using scss, postcss, html and js. Based on HtmlWebpackPlugin. Comes with postcss autoprefixer.
A webpack configuration for webdevs using scss, postcss, html and js. Based on HtmlWebpackPlugin. Comes with postcss autoprefixer.
As described in this article webpack configuration can be split.
After splitting we should have three files:
When using import and export in js files eslint produces and error:
'import' and 'export' may appear only with 'sourceType: module'
That can be mitigated by adding the following parser options to .eslintrc:
"parserOptions": {
"sourceType": "module"
}
Extend standard style linting with eslint-plugin-compat plugin. This plugin looks into browserslist and checks whether written code is conform.
Configure npm linting test in package.json
to use this plugin
Outsource variables to variables.json
file and reference them in sass and js.
Explain how to configure vscode stylelint extension to be
How to:
.vscode
in the workspace foldersettings.json
settings.json
:{
"window.zoomLevel": -1,
"css.validate": false,
"less.validate": false,
"scss.validate": false,
"stylelint.enable": true
}
integrate stylelint and add it to npm linting tests.
Also install vscode extension!
Add this line to .stylelintrc:
"rules": {
"indentation": 4
}
Add webpack-cli to node_modules:
npm install --save-dev webpack-cli
Currently htmlhint enforces id and class separation characters to be underdashes.
Change this to dashes.
Currently svg fonts are bundled twice. Once with svg loader and once with font loader. That has to be disabled.
Generating more than one html file leaves the question which html file should contain which files specified in the webpack config entries.
This can be defined with the chunks option.
For every htmlwebpackplugin instance, declare the entry-name which should be used.
E.g. for lemon.html we would take the 'lemon' entry:
new HtmlWebpackPlugin({
chunks: ['lemon'],
template: './src/html/lemon.html',
filename: './html/lemon.html',
}),
Add
"env": {
"es6": true
}
to .eslintrc.json
Add libpng package to nodejs install command.
Image-webpack-loader should only optimize images in production mode.
Add: disable: true
to the image-webpack-loader options.
Q&A.md should be a list of questions that appear when implementing a website.
in case of dedicated font files (e.g. usage of @font-face
):
Add my experience with @font-face
to code guide:
@font-face
declaration, how to download fonts with fontsquirrel.comAdd a last step to README.md install instructions:
Whenever changes to configuration files are made, reload the window in VS Code:
Reload Window
This has to be done to make extensions reload their configuration files (e.g. stylelint and .stylelintrc)
add CopyWebpackPlugin for assets that are not passed to a loader by reference
Create two configuration files for webpack:
For production mode:
mode: production
For development mode:
mode: development
devtool: 'source-map'
Don't forget to add corresponding entries in package.json for each mode
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.