Skip to content

Commit

Permalink
More ES6 updates.
Browse files Browse the repository at this point in the history
Release v0.8.3.
  • Loading branch information
XhmikosR committed Apr 11, 2018
1 parent 7ad6a27 commit ca54878
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# grunt-uncss Changelog

## v0.8.2
## v0.8.3

* Update devDependencies.
* Switch to ES6.
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "grunt-uncss",
"description": "A grunt task for generating CSS files containing only those styles used in your project.",
"version": "0.8.2",
"version": "0.8.3",
"homepage": "https://github.com/uncss/grunt-uncss",
"author": "Addy Osmani <addyosmani@gmail.com> (https://addyosmani.com/)",
"maintainers": [
Expand Down
10 changes: 5 additions & 5 deletions tasks/uncss.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ module.exports = function (grunt) {
return true;
} else if (!grunt.file.exists(filepath)) {
// Warn on and remove invalid local source files (if nonull was set).
grunt.log.warn('Source file ' + chalk.cyan(filepath) + ' not found.');
grunt.log.warn(`Source file ${chalk.cyan(filepath)} not found.`);
return false;
}
return true;
});

if (src.length === 0 && file.src.length === 0) {
grunt.fail.warn('Destination (' + file.dest + ') not written because src files were empty.');
grunt.fail.warn(`Destination (${file.dest}) not written because src files were empty.`);
}

try {
Expand All @@ -43,7 +43,7 @@ module.exports = function (grunt) {
}

grunt.file.write(file.dest, output);
grunt.log.writeln('File ' + chalk.cyan(file.dest) + ' created: ' + maxmin(report.original, output, options.report === 'gzip'));
grunt.log.writeln(`File ${chalk.cyan(file.dest)} created: ${maxmin(report.original, output, options.report === 'gzip')}`);

if (typeof options.reportFile !== 'undefined' && options.reportFile.length > 0) {
grunt.file.write(options.reportFile, JSON.stringify(report));
Expand All @@ -54,11 +54,11 @@ module.exports = function (grunt) {
const error = new Error('Uncss failed.');

if (err.msg) {
error.message += ', ' + err.msg + '.';
error.message += `, ${err.msg}.`;
}

error.origError = err;
grunt.log.warn('Uncssing source "' + src + '" failed.');
grunt.log.warn(`Uncssing source "${src}" failed.`);
grunt.fail.warn(error);
}
});
Expand Down
12 changes: 5 additions & 7 deletions tests/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ const path = require('path');
const expect = require('chai').expect;
const uncss = require('uncss');

const readFile = function (file) {
return fs.readFileSync(path.join(__dirname, file), 'utf-8');
};
const readFile = file => fs.readFileSync(path.join(__dirname, file), 'utf-8');

let rawcss = readFile('output.css');
const urlcss = readFile('outputUrl.css');
const tests = fs.readdirSync(path.join(__dirname, 'fixtures/'));

/* Only read through CSS files */
tests.forEach(test => {
if (test.indexOf('.css') > -1) {
readFile('fixtures/' + test);
if (test.includes('.css')) {
readFile(`fixtures/${test}`);
}
});

Expand Down Expand Up @@ -68,8 +66,8 @@ describe('uncss', () => {
/* We're testing that the CSS is stripped out from the result,
not that the result contains the CSS in the unused folder. */
tests.forEach(test => {
it('should handle ' + test.split('.')[0], () => {
expect(rawcss).to.not.include.string(readFile('unused/' + test));
it(`should handle ${test.split('.')[0]}`, () => {
expect(rawcss).to.not.include.string(readFile(`unused/${test}`));
});
});
});

0 comments on commit ca54878

Please sign in to comment.