Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit af808c8

Browse files
committed
Replace Grunt tasks with npm scripts
1 parent 241c990 commit af808c8

File tree

6 files changed

+49
-97
lines changed

6 files changed

+49
-97
lines changed

Gruntfile.js

-84
This file was deleted.

_includes/scripts.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
var BASE_URL = '{{ site.url }}';
33
</script>
44

5-
<script src="{{ '/assets/js/vendor/jquery-1.9.1.min.js' | relative_url }}"></script>
6-
<script src="{{ '/assets/js/scripts.min.js' | relative_url }}"></script>
5+
<script src="{{ '/assets/js/main.min.js' | relative_url }}"></script>
76

87
{% if site.owner.google.analytics %}
98
<!-- Asynchronous Google Analytics snippet -->

assets/js/main.min.js

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/scripts.min.js

-2
This file was deleted.

banner.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const fs = require("fs");
2+
const pkg = require("./package.json");
3+
const filename = "assets/js/main.min.js";
4+
const script = fs.readFileSync(filename);
5+
const padStart = str => ("0" + str).slice(-2);
6+
const dateObj = new Date();
7+
const date = `${dateObj.getFullYear()}-${padStart(
8+
dateObj.getMonth() + 1
9+
)}-${padStart(dateObj.getDate())}`;
10+
const banner = `/*!
11+
* So Simple Jekyll Theme ${pkg.version} by ${pkg.author}
12+
* Copyright 2013-${dateObj.getFullYear()} Michael Rose - mademistakes.com | @mmistakes
13+
* Licensed under ${pkg.license}
14+
*/
15+
`;
16+
17+
if (script.slice(0, 3) != "/**") {
18+
fs.writeFileSync(filename, banner + script);
19+
}

package.json

+20-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
2-
"name": "so-simple-theme",
3-
"author": "Michael Rose <[email protected]>",
2+
"name": "jekyll-theme-so-simple",
3+
"description": "A Jekyll theme for words and pictures",
4+
"version": "3.0.0",
5+
"author": "Michael Rose",
46
"homepage": "http://mmistakes.github.io/so-simple-theme/",
57
"repository": {
68
"type": "git",
@@ -9,16 +11,25 @@
911
"bugs": {
1012
"url": "https://github.com/mmistakes/so-simple-theme/issues"
1113
},
14+
"keywords": [
15+
"jekyll",
16+
"theme",
17+
"minimal",
18+
"responsive"
19+
],
20+
"license": "MIT",
1221
"engines": {
1322
"node": ">= 0.10.0"
1423
},
1524
"devDependencies": {
16-
"grunt": "~0.4.1",
17-
"grunt-contrib-clean": "~0.5.0",
18-
"grunt-contrib-jshint": "~0.6.3",
19-
"grunt-contrib-uglify": "~0.2.2",
20-
"grunt-contrib-watch": "~0.5.2",
21-
"grunt-contrib-imagemin": "~0.2.0",
22-
"grunt-svgmin": "~0.2.0"
25+
"npm-run-all": "^1.7.0",
26+
"onchange": "^2.2.0",
27+
"uglify-js": "^2.6.1"
28+
},
29+
"scripts": {
30+
"uglify": "uglifyjs assets/js/vendor/jquery-1.9.1.min.js assets/js/plugins/jquery.fitvids.js assets/js/plugins/jquery.magnific-popup.js assets/js/plugins/responsive-nav.js assets/js/_main.js -c -m -o assets/js/main.min.js",
31+
"add-banner": "node banner.js",
32+
"watch:js": "onchange \"assets/js/**/*.js\" -e \"assets/js/main.min.js\" -- npm run build:js",
33+
"build:js": "npm run uglify && npm run add-banner"
2334
}
2435
}

0 commit comments

Comments
 (0)