Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: webpack-contrib/html-loader
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.0
Choose a base ref
...
head repository: webpack-contrib/html-loader
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.2.0
Choose a head ref
  • 18 commits
  • 31 files changed
  • 4 contributors

Commits on Apr 3, 2020

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    LastDragon-ru Aleksei Lebedev
    Copy the full SHA
    931cfba View commit details

Commits on Apr 11, 2020

  1. docs: fix readme (#280)

    JojOatXGME authored Apr 11, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    LastDragon-ru Aleksei Lebedev
    Copy the full SHA
    8e64ff2 View commit details

Commits on Apr 24, 2020

  1. Copy the full SHA
    ee30fe6 View commit details

Commits on Jun 18, 2020

  1. refactor: code

    evilebottnawi authored Jun 18, 2020
    Copy the full SHA
    02d0188 View commit details

Commits on Jul 24, 2020

  1. refactor: code

    evilebottnawi authored Jul 24, 2020
    Copy the full SHA
    afcd2c9 View commit details
  2. Copy the full SHA
    ddad9f2 View commit details

Commits on Aug 11, 2020

  1. Copy the full SHA
    9e3a780 View commit details
  2. fix: perf (#300)

    evilebottnawi authored Aug 11, 2020
    Copy the full SHA
    d69f259 View commit details
  3. Copy the full SHA
    420dccc View commit details
  4. Copy the full SHA
    1acd204 View commit details
  5. fix: include feature (#303)

    evilebottnawi authored Aug 11, 2020
    Copy the full SHA
    2c640c6 View commit details
  6. Verified

    This commit was signed with the committer’s verified signature.
    ramsey Ben Ramsey
    Copy the full SHA
    03152b1 View commit details

Commits on Aug 12, 2020

  1. refactor: code (#305)

    evilebottnawi authored Aug 12, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    ramsey Ben Ramsey
    Copy the full SHA
    3584ae6 View commit details

Commits on Aug 17, 2020

  1. Verified

    This commit was signed with the committer’s verified signature.
    ramsey Ben Ramsey
    Copy the full SHA
    b92ed21 View commit details

Commits on Aug 18, 2020

  1. Copy the full SHA
    c247cfa View commit details
  2. Copy the full SHA
    b8ee9ee View commit details
  3. Copy the full SHA
    48779bb View commit details
  4. chore(release): 1.2.0

    alexander-akait committed Aug 18, 2020
    Copy the full SHA
    8d7db7f View commit details
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -10,3 +10,6 @@ trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[test/fixtures/*.html]
insert_final_newline = false
95 changes: 95 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: html-loader

on:
push:
branches:
- master
- next
pull_request:
branches:
- master
- next

jobs:
lint:
name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }}

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

strategy:
matrix:
os: [ubuntu-latest]
node-version: [12.x]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.node-version }}

- name: Use latest NPM
run: sudo npm i -g npm

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

# - name: Security audit
# run: npm run security

- name: Check commit message
uses: wagoid/commitlint-github-action@v1

test:
name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10.x, 12.x, 14.x]
webpack-version: [latest, next]

runs-on: ${{ matrix.os }}

steps:
- name: Setup Git
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf input

- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Use latest NPM on ubuntu/macos
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: sudo npm i -g npm

- name: Use latest NPM on windows
if: matrix.os == 'windows-latest'
run: npm i -g npm

- name: Install dependencies
run: npm ci

- name: Install webpack ${{ matrix.webpack-version }}
run: npm i webpack@${{ matrix.webpack-version }}

- name: Run tests for webpack version ${{ matrix.webpack-version }}
run: npm run test:coverage -- --ci

- name: Submit coverage data to codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,22 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.2.0](https://github.com/webpack-contrib/html-loader/compare/v1.1.0...v1.2.0) (2020-08-18)


### Features

* support SVG tags ([#302](https://github.com/webpack-contrib/html-loader/issues/302)) ([1acd204](https://github.com/webpack-contrib/html-loader/commit/1acd20448dbe976b883597b135bb8ac9e1b71d1a))


### Bug Fixes

* do not handle non standard `script` types ([ddad9f2](https://github.com/webpack-contrib/html-loader/commit/ddad9f2d6f5ab75fe2afd247bf55b1646c6e1c31))
* inline syntax for sources ([#310](https://github.com/webpack-contrib/html-loader/issues/310)) ([c247cfa](https://github.com/webpack-contrib/html-loader/commit/c247cfa9ad66281b28aef5397c8c2d2786f05867))
* linefeed characters in sources ([#311](https://github.com/webpack-contrib/html-loader/issues/311)) ([b8ee9ee](https://github.com/webpack-contrib/html-loader/commit/b8ee9ee0d60848e84e52fb117c1f3cdc2ebf08d7))
* minimize is more safely ([#304](https://github.com/webpack-contrib/html-loader/issues/304)) ([03152b1](https://github.com/webpack-contrib/html-loader/commit/03152b1d3b807a287d84302f6a9987ceb22d395c))
* perf ([#300](https://github.com/webpack-contrib/html-loader/issues/300)) ([d69f259](https://github.com/webpack-contrib/html-loader/commit/d69f259d2a6b4bc9ba9c163fd2d70989c3f3a6ff))

## [1.1.0](https://github.com/webpack-contrib/html-loader/compare/v1.0.0...v1.1.0) (2020-04-02)


60 changes: 31 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="center">
<img width="200" height="200" src="https://worldvectorlogo.com/logos/html5.svg" alt="html-loader">
<a href="https://github.com/webpack/webpack">
<img width="200" height="200" vspace="" hspace="25" src="https://worldvectorlogo.com/logos/webpack.svg" alt="webpack">
<img width="200" height="200" vspace="" hspace="25" src="https://webpack.js.org/assets/icon-square-big.svg" alt="webpack">
</a>
</div>

@@ -484,16 +484,20 @@ Tell `html-loader` to minimize HTML.

The enabled rules for minimizing by default are the following ones:

- `collapseWhitespace`
- `conservativeCollapse`
- `keepClosingSlash`
- `minifyCSS`
- `minifyJS`
- `removeAttributeQuotes`
- `removeComments`
- `removeScriptTypeAttributes`
- `removeStyleTypeAttributes`
- `useShortDoctype`
```js
({
caseSensitive: true,
collapseWhitespace: true,
conservativeCollapse: true,
keepClosingSlash: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
});
```

**webpack.config.js**

@@ -590,27 +594,30 @@ module.exports = {
};
```

**file.html**

```html
<!-- file.html -->
<img src="image.png" data-src="image2x.png" />
<img src="image.jpg" data-src="image2x.png" />
```

**index.js**

```js
require('html-loader!./file.html');

// => '<img src="http://cdn.example.com/49eba9f/a992ca.png" data-src="image2x.png">'
// => '<img src="http://cdn.example.com/49eba9f/a992ca.jpg" data-src="image2x.png">'
```

```js
require('html-loader?attributes[]=img:data-src!./file.html');
require('html-loader?{"attributes":{"list":[{"tag":"img","attribute":"data-src","type":"src"}]}}!./file.html');

// => '<img src="image.png" data-src="data:image/png;base64,..." >'
// => '<img src="image.jpg" data-src="data:image/png;base64,..." >'
```

```js
require('html-loader?attributes[]=img:src&attributes[]=img:data-src!./file.html');
require('html-loader?{"attributes":{"list":[{"tag":"img","attribute":"src","type":"src"},{"tag":"img","attribute":"data-src","type":"src"}]}}!./file.html');

// => '<img src="http://cdn.example.com/49eba9f/a992ca.png" data-src="data:image/png;base64,..." >'
// => '<img src="http://cdn.example.com/49eba9f/a992ca.jpg" data-src="data:image/png;base64,..." >'
```

```js
@@ -619,12 +626,7 @@ require('html-loader?-attributes!./file.html');
// => '<img src="image.jpg" data-src="image2x.png" >'
```

> :warning: `-attributes` it is set attributes: false
```html
'<img src=http://cdn.example.com/49eba9f/a9f92ca.jpg
data-src=data:image/png;base64,...>'
```
> :warning: `-attributes` sets `attributes: false`.
### Process `script` and `link` tags

@@ -694,7 +696,7 @@ module.exports = {

### 'Root-relative' URLs

With the same configuration as above:
With the same configuration as in the CDN example:

**file.html**

@@ -713,7 +715,7 @@ require('html-loader!./file.html');
**other-scripts.js**

```js
require('html-loader?root=.!./file.html');
require('html-loader?{"attributes":{"root":"."}}!./file.html');

// => '<img src="http://cdn.example.com/49eba9f/a992ca.jpg">'
```
@@ -789,7 +791,7 @@ module.exports = {
test: /\.hbs$/i,
loader: 'html-loader',
options: {
preprocessor: () => {
preprocessor: (content, loaderContext) => {
let result;

try {
@@ -855,8 +857,8 @@ Please take a moment to read our contributing guidelines if you haven't yet done
[node-url]: https://nodejs.org
[deps]: https://david-dm.org/webpack-contrib/html-loader.svg
[deps-url]: https://david-dm.org/webpack-contrib/html-loader
[tests]: https://dev.azure.com/webpack-contrib/html-loader/_apis/build/status/webpack-contrib.html-loader?branchName=master
[tests-url]: https://dev.azure.com/webpack-contrib/html-loader/_build/latest?definitionId=38&branchName=master
[tests]: https://github.com/webpack-contrib/html-loader/workflows/html-loader/badge.svg
[tests-url]: https://github.com/webpack-contrib/html-loader/actions
[cover]: https://codecov.io/gh/webpack-contrib/html-loader/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack-contrib/html-loader
[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
Loading