Skip to content

Commit

Permalink
Merge pull request #12 from thescientist13/issue-9-webpack-v4-upgrade
Browse files Browse the repository at this point in the history
webpack v4 compatibility upgrade
  • Loading branch information
anthonygore authored May 14, 2018
2 parents 5a916be + 5cf8d57 commit b89192b
Show file tree
Hide file tree
Showing 9 changed files with 5,112 additions and 498 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A fork of Critical Webpack Plugin.

This is simplified and runs after all files have been emitted so you can use it after Extract Text and HTML Webpack Plugin.

**Note**: [As **critical** itself has a dependency on puppeteer](https://github.com/addyosmani/critical/releases/tag/v1.0.0) in order to run Headless Chrome, consumers of this plugin will need to make sure that their build environment (local, CI, etc) where running webpack with this plugin has the necessary operating system packages installed. See this page for more information on [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) puppeteer.
**Note**: [As **critical** itself has a dependency on puppeteer](https://github.com/addyosmani/critical/releases/tag/v1.0.0) in order to run Headless Chrome, consumers of this plugin will need to make sure that their build environment (local, CI, etc) where they are running webpack with this plugin has the necessary operating system packages installed. See this page for more information on [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) puppeteer.

### Install

Expand Down Expand Up @@ -44,6 +44,8 @@ module.export = {
Read [Critical CSS and Webpack: Automatically Minimize Render-Blocking CSS](https://vuejsdevelopers.com/2017/07/24/critical-css-webpack/) blogpost.

### Development

#### Local Environment
Since the main dependency of this project, critical, depends on an environment that supports Headless Chrome, [Docker](https://www.docker.com/) has been provided to support local development of this project.

After you have [installed Docker](https://www.docker.com/community-edition), you can do the following to get setup:
Expand All @@ -57,4 +59,9 @@ Now you can run the project's `npm` scripts like usuual:

**_Note_**: changes are bi-directional

Learn more about Docker [here](https://docs.docker.com/get-started/) or [configuring Headless Chrome for your own machine](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md).
Learn more about Docker [here](https://docs.docker.com/get-started/) or [configuring Headless Chrome for your own machine](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md).

#### Workflows
1. To run unit tests - `npm run test`
1. To build the project - `npm run ci`
1. To build the project for release - `npm run build`
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ HtmlCriticalWebpackPlugin.prototype.emit = function(compilation, callback) {

HtmlCriticalWebpackPlugin.prototype.apply = function(compiler) {
var self = this;
compiler.plugin('after-emit', function (compilation, callback) {
compiler.hooks.afterEmit.tapAsync('HtmlCriticalWebpackPlugin', function (compilation, callback) {
self.emit(compilation, callback);
});
};
Expand Down
Loading

0 comments on commit b89192b

Please sign in to comment.