From the course: SharePoint Framework for Developers: 1 Understanding the Toolchain
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Use webpack to bundle CSS
From the course: SharePoint Framework for Developers: 1 Understanding the Toolchain
Use webpack to bundle CSS
- [Instructor] Now so far we have seen an example of Webpack allowing us to bundle a JavaScript file. A JavaScript file that has dependencies on other JavaScript files and be able to run it as a single bundle.js. Webpack can be used to bundle other kinds of files as well. So next let's look at how Webpack helps us bundle CSS files. So I'm going to go ahead and introduce a new file here called style.css. And inside here I will place a simple style. Now what I wish to be able to do is that this hello style that we have introduced, I would like this hello style to be used in the new element that we are creating here. So let's make a minor code change here to sort of verify that indeed the style does get used. So the code change I need to make here is actually very simple. I simply say element.classlist.add hello. The end result of this will be that the element that we are adding will now have a class, a css class associated with it called hello. And that is the class that we have…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Introduction and need for webpack3m 30s
-
(Locked)
Example of a simple website breaking without webpack4m 54s
-
(Locked)
Example of webpack fixing the problem of interdependent scripts6m 17s
-
(Locked)
Use webpack.config.js3m 31s
-
(Locked)
Use webpack to bundle CSS6m 25s
-
(Locked)
Use webpack to bundle images5m 5s
-
(Locked)
Use webpack to create distributable versions of our application6m 43s
-
(Locked)
-
-
-
-
-