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 images
From the course: SharePoint Framework for Developers: 1 Understanding the Toolchain
Use webpack to bundle images
- [Instructor] Now I just showed you how Webpack allows us to bundle a CSS file. Webpack can also actually bundle any kind of artifact. One of the most common kinds of artifacts we need to bundle are images. Why do we need to bundle them ahead of time? Well, a lot of reasons. Perhaps you want them to be available offline. Maybe they're coming off of a URL. Maybe you want to have separate file names so they don't conflict with each other especially imagine if you drop a web part on a page and you are referencing logo.png and somebody else is referencing logo.png, the file names could conflict. So, let's see how we can modify this project to include an image. Here's how we do that. I have a simple image on my desktop called hello.png. You can use any image, I just created one using MS Paint. Really the actual image doesn't matter. Let's go ahead and make this a part of my source code. Now, let's go to index.js and make some minor code changes. Number one, I will import that image. So…
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)
-
-
-
-
-