Home > Web Front-end > JS Tutorial > body text

How to manage CSS and other resources in webpack and SPA

亚连
Release: 2018-06-20 11:37:34
Original
1468 people have browsed it

This article mainly introduces the methods of managing CSS and other resources in webpack and SPA practice. The editor thinks it is quite good, so I will share it with you now and give it as a reference. Let’s follow the editor and take a look.

The previous article introduced how to use webpack to build a stable development environment that supports local services, automatic refresh, module hot replacement, and writing JavaScript using ES6. This article mainly introduces webpack. How to handle another element of the three major elements of HTML applications - CSS and other resources such as images, font files or data configuration files.

Preface

When learning to use webpack, we need to understand that no matter how it is designed, what its working principle and process are, the most fundamental thing it processes is HTML. HTML tags, JavaScript, CSS, images and other resources in the document, and the final processing result must still be an HTML document, including DOM, JavaScript, CSS. There are three ways for CSS to exist in the document: inline style, inline The use of styles, external link styles, and inline styles has long been deprecated, so there are only two ways for webpack to process CSS:

  1. ##Inline style: Use the