-
Notifications
You must be signed in to change notification settings - Fork 29
Parse assets from index.html #127
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
Conversation
Parse `<img src>`, `<script src>`, and `<link href>` assets from `src/index.html`. If the asset is not in the `/assets` directory, is not a remote resource, and its file name does not begin with "/", then copy it to the output and hash its file name.
Codecov Report
@@ Coverage Diff @@
## next #127 +/- ##
==========================================
- Coverage 59.76% 59.71% -0.05%
==========================================
Files 8 8
Lines 425 427 +2
Branches 93 91 -2
==========================================
+ Hits 254 255 +1
- Misses 171 172 +1
Continue to review full report at Codecov.
|
@@ -336,7 +365,7 @@ export default function webpackConfigFactory(args: any): WebpackConfiguration { | |||
include: allPaths, | |||
test: /\.css$/, | |||
exclude: /\.m\.css$/, | |||
use: cssLoader | |||
oneOf: [{ issuer: indexHtmlPattern, use: 'identity-loader' }, { use: cssLoader }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although this works and is neat (conditionally applying a loader on issuer), we need to fix these loader paths unrelated to the PR anyway as we shouldn’t be processing modules outside of src
or test
regardless of issuer. We currently have side effects elsewhere due to this (ie we are processing external/node_modules css through these loaders).
@matt-gadd I updated the |
- Parse, copy, and hash `<img src>`, `<script src>`, and `<link href>` assets from `src/index.html`. - Update the CSS rules to limit processing to the `src/` and `tests/` directories. - Ignore all assets imported from the `assets/` directory. - Change Dojo 2 to Dojo in README.md. - Add the `ico` extension to the images rule.
- Parse, copy, and hash `<img src>`, `<script src>`, and `<link href>` assets from `src/index.html`. - Update the CSS rules to limit processing to the `src/` and `tests/` directories. - Ignore all assets imported from the `assets/` directory. - Change Dojo 2 to Dojo in README.md. - Add the `ico` extension to the images rule.
Read, copy, and hash assets read from
<img src>
,<script src>
, and<link href>
tags in an application'sindex.html
. Remote file paths and those beginning with/
are ignored. Resources can still be read from thesrc/
directory, with the caveat that script and CSS files that have been parsed fromindex.html
are treated as independent from the main build pipeline (e.g., asrc/custom-styles.css
file that's bundles withmain.css
but directly imported insrc/index.html
will result in an additionalcustom-styles.[hash].css
being output).Also updates the image loader to keep the original file name in hashed output.
Resolves #124