Skip to content

Commit

Permalink
Merge pull request #59 from bezoerb/dev
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
bezoerb authored Jun 16, 2020
2 parents 8e9b329 + b1ef7db commit 03c045b
Show file tree
Hide file tree
Showing 9 changed files with 2,538 additions and 1,065 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# http://editorconfig.org
# https://editorconfig.org/
root = true

[*]
Expand Down
13 changes: 0 additions & 13 deletions .jshintrc

This file was deleted.

45 changes: 16 additions & 29 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
'use strict';

var finalhandler = require('finalhandler');
var http = require('http');
var serveStatic = require('serve-static');
const http = require('http');
const finalhandler = require('finalhandler');
const serveStatic = require('serve-static');

module.exports = function (grunt) {
module.exports = grunt => {
require('load-grunt-tasks')(grunt);
grunt.initConfig({

pkg: grunt.file.readJSON('package.json'),
complexity: {
generic: {
src: ['tasks/critical.js'],
options: {
errorsOnly: false,
cyclometric: 3, // default is 3
halstead: 8, // default is 8
maintainability: 100 // default is 100
cyclometric: 3, // default is 3
halstead: 8, // default is 8
maintainability: 100 // default is 100
}
}
},
jshint: {
all: [
'Gruntfile.js',
'tasks/**/*.js',
'test/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
simplemocha: {
all: ['test/**/*.js'],
options: {
Expand Down Expand Up @@ -109,7 +97,7 @@ module.exports = function (grunt) {
'test/fixture/styles/bootstrap.css'
],
inline: {
ignore: [/bootstrap\.css/],
ignore: [/bootstrap\.css/]
},
width: 1300,
height: 900
Expand Down Expand Up @@ -251,25 +239,24 @@ module.exports = function (grunt) {
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');

var server;
grunt.registerTask('startServer', function () {
var serve = serveStatic('test/fixture', {
let server;
grunt.registerTask('startServer', () => {
const serve = serveStatic('test/fixture', {
index: ['index.html', 'index.htm']
});

server = http.createServer(function (req, res) {
var done = finalhandler(req, res);
server = http.createServer((req, res) => {
const done = finalhandler(req, res);
serve(req, res, done);
});
server.listen(3000);
});

grunt.registerTask('stopServer', function () {
grunt.registerTask('stopServer', () => {
server.close();
});


grunt.registerTask('test', ['jshint', 'startServer', 'critical', 'stopServer', 'simplemocha', 'watch']);
grunt.registerTask('ci', ['jshint', 'startServer', 'critical', 'stopServer', 'simplemocha']);
grunt.registerTask('test', ['startServer', 'critical', 'stopServer', 'simplemocha', 'watch']);
grunt.registerTask('ci', ['startServer', 'critical', 'stopServer', 'simplemocha']);
grunt.registerTask('default', ['test']);
};
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Grunt plugin to extract & inline critical-path CSS from HTML

## Getting Started

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
If you haven't used [Grunt](https://gruntjs.com/) before, be sure to check out the [Getting Started](https://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](https://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-critical --save-dev
Expand All @@ -24,7 +24,7 @@ grunt.loadNpmTasks('grunt-critical');

_Run this task with the `grunt critical` command._

Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
Task targets, files and options may be specified according to the grunt [Configuring tasks](https://gruntjs.com/configuring-tasks) guide.

Generate critical path css and inline it with [critical](https://github.com/addyosmani/critical).

Expand Down
Loading

0 comments on commit 03c045b

Please sign in to comment.