Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

abort css requests plugin

  • Loading branch information...
commit 7f8295115e5910547a612b7887bb8ff435f08b1a 1 parent 99d5d74
Max Ivanov maximivanov authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/plugins/abortCssRequests.js
14 lib/plugins/abortCssRequests.js
View
@@ -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.