Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from geometria-lab/feature/abortCssPlugin

abort css requests plugin
  • Loading branch information...
commit fcb01200934350f8249badf8c869898b9e6861df 2 parents 99d5d74 + 7f82951
@Shumkov Shumkov authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/plugins/abortCssRequests.js
View
14 lib/plugins/abortCssRequests.js
@@ -0,0 +1,14 @@
+module.exports = {
+ beforeEngineInit: function (renderer, engine, next) {
+ if (engine.phantom !== undefined) {
+ engine.phantom.page.onResourceRequested(function (requestData, networkRequest) {
+ var regex = /.+\.css$/i;
+ if (regex.test(requestData.url)) {
+ networkRequest.abort();
+ }
+ });
+ }
+
+ next();
+ }
+};
Please sign in to comment.
Something went wrong with that request. Please try again.