Skip to content

Commit

Permalink
Merge pull request #1 from parcel-bundler/master
Browse files Browse the repository at this point in the history
1/31 changes.
  • Loading branch information
sainthkh committed Jan 30, 2019
2 parents 647f82d + 0ada4d6 commit 1cde90f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
40 changes: 24 additions & 16 deletions packages/core/integration-tests/test/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,20 @@ describe('html', function() {
});

it('should minify HTML in production mode', async function() {
await bundle(path.join(__dirname, '/integration/htmlnano/index.html'), {
let inputFile = path.join(__dirname, '/integration/htmlnano/index.html');
await bundle(inputFile, {
production: true
});

let html = await fs.readFile(
path.join(__dirname, '/dist/index.html'),
'utf8'
);
let inputSize = (await fs.stat(inputFile)).size;

let outputFile = path.join(__dirname, '/dist/index.html');
let outputSize = (await fs.stat(outputFile)).size;

assert(inputSize > outputSize);

let html = await fs.readFile(outputFile, 'utf8');
assert(html.includes('Other page'));
assert(!html.includes('\n'));
});

it('should read .htmlnanorc and minify HTML in production mode', async function() {
Expand Down Expand Up @@ -326,19 +330,23 @@ describe('html', function() {
});

it('should not minify default values inside HTML in production mode', async function() {
await bundle(
path.join(__dirname, '/integration/htmlnano-defaults-form/index.html'),
{
production: true
}
let inputFile = path.join(
__dirname,
'/integration/htmlnano-defaults-form/index.html'
);
await bundle(inputFile, {
production: true
});

let html = await fs.readFile(
path.join(__dirname, '/dist/index.html'),
'utf8'
);
let inputSize = (await fs.stat(inputFile)).size;

let outputFile = path.join(__dirname, '/dist/index.html');
let outputSize = (await fs.stat(outputFile)).size;

assert(inputSize > outputSize);

let html = await fs.readFile(outputFile, 'utf8');
assert(html.includes('<input type="text">'));
assert(!html.includes('\n'));
});

it('should not prepend the public path to assets with remote URLs', async function() {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/parcel-bundler/src/assets/PugAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PugAsset extends Asset {
compileDebug: false,
filename: this.name,
basedir: path.dirname(this.name),
pretty: !this.options.minify,
pretty: config.pretty || false,
templateName: path.basename(this.basename, path.extname(this.basename)),
filters: config.filters,
filterOptions: config.filterOptions,
Expand Down
1 change: 0 additions & 1 deletion packages/core/parcel-bundler/test/sourcemaps.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const assert = require('assert');
const fs = require('@parcel/fs');
const SourceMap = require('../src/SourceMap');

describe('sourcemaps', function() {
Expand Down

1 comment on commit 1cde90f

@sainthkh
Copy link
Contributor Author

@sainthkh sainthkh commented on 1cde90f Jan 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I messed things up by merging the change into my forked repo. I'll close this PR and open a new one without that commit. (+ I'll create my own branch in my forked version.)

Please sign in to comment.