Coder Social home page Coder Social logo

gulp-louis's Introduction

Louis

Louis is a gulp task that is used to analyze the performance of a website against a performance budget.

npm version Greenkeeper badge

NPM

Introduction

There are many definitions of the performance budget on the web, my favourite is from Zachary Brady.

A performance budget provides values against which design, development, content, or any aspect of a site that may affect performance, can be made.

The aim of the plugin is to analyze the performance of the website against a performance bugdet. There are various metrics against which we can set a performance budget e.g. number of requests, imageSize etc.

Getting started

Installation

Getting Started

Usage

$ npm install --save-dev gulp-louis
import louis = require('gulp-louis');

gulp.task('louis', function(done) {
  louis({
    timeout: 60,
    viewport: '1280x1024',
    engine: 'webkit',
    userAgent: 'Chrome/37.0.2062.120',
    noExternals: false,
    performanceBudget: {
      requests: 2,
      medianLatency: 10,
      slowestResponse: 1000
    }
  }, done);
});

gulp.task('default', ['louis']);

Example

Example 1 (with specified url)

louis({
  url: 'http://localhost:8000/',
  timeout: 200,
  performanceBudget: {
    requests: 10,
    domComplete: 3000
  }
})

Example 2 (without url) This will launch a server and look for an index.html in the same folder as the gulpfile.js, then it will analyze the performance of this website.

louis({
  timeout: 10,
  performanceBudget: {
    requests: 10,
    headersSize: 200
  }
})

Output

Output with specified performance budget

Screenshot1

Output without specified performance budget

Screenshot1

Options

All options are optional

  • url url of the website to be analyzed, if it is not specified Louis will launch a server and load the index.html if this exist on the same directory as the gulpfile.js
  • timeout timeout for the run (defaults to 15 seconds)
  • viewport dimensions ('1280x1024' is the default)
  • engine webkit or gecko (webkit is default)
  • userAgent default is Chrome/37.0.2062.120
  • noExternals true or false, default is false, block requests to 3rd party domains
  • outputFileName name of file to write the results, default is "results.json"
  • performanceBudget object with metrics, see below
  • proxy specifies the (optional) proxy server to use

Performance Budget Options

The performance budget option can contain some or all of these values:

requests, gzipRequests, postRequests, httpsRequests, notFound, bodySize, contentLength, httpTrafficCompleted, timeToFirstByte, timeToLastByte, ajaxRequests, htmlCount, htmlSize, cssCount, cssSize, jsCount, jsSize, jsonCount, jsonSize, imageCount, imageSize, videoCount, videoSize, webfontCount, webfontSize, base64Count, base64Size, otherCount, otherSize, cacheHits, cacheMisses, cachePasses, cachingNotSpecified, cachingTooShort, cachingDisabled, oldCachingHeaders, consoleMessages, cookiesSent, cookiesRecv, domainsWithCookies, documentCookiesLength, documentCookiesCount, documentHeight, commentsSize, whiteSpacesSize, DOMelementsCount, DOMelementMaxDepth, nodesWithInlineCSS, imagesScaledDown, imagesWithoutDimensions, DOMidDuplicated, hiddenContentSize, DOMmutationsInsertsv, DOMmutationsRemoves, DOMmutationsAttributes, DOMqueries, DOMqueriesWithoutResults, DOMqueriesById, DOMqueriesByClassName, DOMqueriesByTagName, DOMqueriesByQuerySelectorAll , DOMinserts, DOMqueriesDuplicated, DOMqueriesAvoidable, domains, maxRequestsPerDomain, medianRequestsPerDomain, eventsBound, eventsDispatched, globalVariables, globalVariablesFalsy, headersCount, headersSentCount, headersRecvCount, headersSize, headersSentSize, headersRecvSize, headersBiggerThanContent, jQueryVersion, jQueryVersionsLoaded, jQueryOnDOMReadyFunctions, jQueryWindowOnLoadFunctions, jQuerySizzleCalls, jQueryEventTriggers, jQueryDOMReads, jQueryDOMWrites, jQueryDOMWriteReadSwitches, documentWriteCalls, evalCalls, jsErrors, closedConnections, localStorageEntries, redirects, redirectsTime, repaints, firstPaint, requestsToDomContentLoaded, requestsToDomComplete, assetsNotGzipped, assetsWithQueryString, assetsWithCookies, smallImages, smallCssFiles, smallJsFiles, multipleRequests, timeToFirstCss, timeToFirstJs, timeToFirstImage, domInteractive, domContentLoaded, domContentLoadedEnd, domComplete, timeBackend, timeFrontend, statusCodesTrail, windowAlerts, windowConfirms, windowPrompts, bodyHTMLSize, iframesCount, smallestResponse, biggestResponse, fastestResponse, slowestResponse, smallestLatency, biggestLatency, medianResponse, medianLatency

Example:

performanceBudget = {
  cssSize: 200
  jsSize: 2000
  consoleMessages: 0
  imageSize: 5000
  domContentLoaded: 2000
  smallestLatency: 1000
}

Change log

[2.3.2] - 2018-03-16

  • Fix / appended to outputFile causing throw in unix systems

[2.3.1] - 2018-02-28

  • Update dependencies

[2.3.0] - 2016-10-07

  • Added proxy-option

[2.2.1] - 2016-09-29

  • Update dependencies

[2.2.0] - 2016-09-29

  • Add outputFilename-option

[2.1.1] - 2016-09-16

  • Update dependencies

[2.1.0] - 2016-09-15

  • Change the results.json to a file with the same of tested domain.

[2.0.0] - 2016-08-29

  • Run phantomas from local path
  • Update depedencies

[1.1.0] - 2016-08-19

  • Fix phantomas path

[1.0.14] - 2015-11-23

Bug Fixes

  • Fix path to phantomas command …

  • Add missing gulp-connect dependency

  • Change "main" script to "louis.js"

[1.0.10] - 2015-02-21

[1.0.9] - 2015-02-21

[1.0.8] - 2015-02-20

[1.0.7] - 2015-02-17

[1.0.0] - 2015-02-16

License

Released under the MIT license.

gulp-louis's People

Contributors

avraam-mavridis-sociomantic avatar avraammavridis avatar bitdeli-chef avatar greenkeeper[bot] avatar mozartdiniz avatar rejas avatar smt avatar zalerner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gulp-louis's Issues

Can not find module 'gulp-louis'

Hi there,

I followed your instructions but cannot get this package to work. Geting the error message: "Cannot find module gulp-louis"?

gulp-louis

Any idea whats wrong?

Greetings

gulp task doesnt complete with gulp4

Using the plugin like this:

// Check the performance budget
gulp.task('check:louis', () => {
    louis({
        performanceBudget: {
            domComplete: 3000,
            requests: 10
        }
    });
});

doesnt end the task correctly and I have to manually end it:

[16:41:25] Requiring external module babel-register
[16:41:27] Using gulpfile C:\Projekte\mine\homepage\gulpfile.babel.js
[16:41:27] Starting 'check:louis'...
[16:41:27] Starting server...
[16:41:28] Server started http://localhost:8888
[16:41:28] Running server

Metrics analyzed against performance budget

requests:  Expected < 10 Actual = 1
domComplete:  Expected < 3000 Actual = 14
[16:41:41] Server stopped
[16:41:41] The following tasks did not complete: check:louis
[16:41:41] Did you forget to signal async completion?
Batchvorgang abbrechen (J/N)?

Phantomas error

I cloned your repo and did npm install. But after executing gulp, I get the following error:

MacBook-Pro-3:gulp-louis sohail$ gulp
(node:10780) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[09:50:52] Using gulpfile ~/GitHub/gulp-louis/gulp-louis/gulpfile.js
[09:50:52] Starting 'louis'...
[09:50:52] Finished 'louis' after 47 ms
[09:50:52] Starting 'default'...
[09:50:52] Finished 'default' after 12 μs
[09:50:52] Server started http://localhost:8888
{ Error: Command failed: phantoms http://localhost:8888 --engine webkit --runs 1 --timeout 60 --viewport 1280x1024 --reporter=json > results.json
/bin/sh: phantoms: command not found

    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:852:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:492:12)
  killed: false,
  code: 127,
  signal: null,
  cmd: 'phantoms http://localhost:8888 --engine webkit --runs 1 --timeout 60 --viewport 1280x1024 --reporter=json > results.json' }

What have I missed?

Thanks
-Sohail

Remove gulp dependency

Hey hey - this looks really nice.

What about removing the gulp dependency before more work goes into it.

People using npm scripts, brocolli, grunt might like it. ;)

Phantomas path bug

When attempting to run gulp-louis with the following config:

{
  "url": "http://localhost:8000/",
  "timeout": 60,
  "performanceBudget": {
    "requests": 2,
    "medianLatency": 10,
    "slowestResponse": 1000
  }
}

I get the following error:

{ [Error: Command failed: /bin/sh -c /Users/zach/Code/my-cool-project/node_modules/gulp-louis/node_modules/.bin/phantomas http://localhost:8000/ --engine webkit --runs 1 --timeout 60 --viewport 1280x1024 --reporter=json > results.json
/bin/sh: /Users/zach/Code/my-cool-project/node_modules/gulp-louis/node_modules/.bin/phantomas: No such file or directory
]

I assume that this is a problem because my project's dependencies do not download their devDependencies during an npm install. See this.

I suspect that the issue was introduced in this PR.

I'm going to fork the repo and try adding phantomas as a dependency rather than as a devDependency. If that works and you consider it an acceptable solution, I'll create a PR.

url option not working

Hello, Really cool tool, thanks! When I try to add a url, I get an error. It looks like it may be adding .json onto the url [www.google.com/.json].
screen shot 2017-04-21 at 2 15 14 pm

Here's how I have it set up:
screen shot 2017-04-21 at 2 16 48 pm

Not sure if I'm doing something wrong or if there is a a bug. It runs fine without a url.

Thanks
Marshall

Performance metric don't seem reliable

I've run this tools against multiple websites and compared that with the reports of webpagetest.org and what the Chrome Developer Tools show me. The results of webpagetest are pretty close to what I get reported by gulp-louis in the json output, but it's way off when compared to the Chrome Dev Tools. Certainly where html, css and js size is concerned.

Can it be that some calculations (additions, subtractions) are done for those particular metrics?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.