Skip to content

Commit

Permalink
Fix CSS source maps, simplify dev mode
Browse files Browse the repository at this point in the history
* Add "npm run" commands in package.json so that following README
  doesn't require npx or globally installed grunt-cli.

* Merge "default" task into "build" for clarity and simplicity.

* Remove unused Procfille and Heroku instructions.

* Remove unused Travis CI.

* Add GitHub CI.

* Fix source maps.

  With source maps fixed, remove the separate less:dev task.
  • Loading branch information
Krinkle committed Sep 8, 2024
1 parent 659188f commit c01f3eb
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 73 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: CI
on:
- push
- pull_request

jobs:
test:
# Includes Firefox, Node.js LTS, and Java.
# https://github.com/actions/runner-images/blob/releases/ubuntu22/20240804/images/ubuntu/Ubuntu2204-Readme.md
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: npm install
- run: npm test
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
node_modules/
tmp/
npm-debug.log
/build/
/node_modules/
/tmp/
/package-lock.json
/npm-debug.log
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

32 changes: 10 additions & 22 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ module.exports = function(grunt) {
sourceMap: true,
outputSourceFiles: true
},
development: {
options: {
paths: ['src/less']
},
files: {
'build/css/main.css': 'src/less/main.less'
}
},
production: {
options: {
paths: ['src/less'],
Expand Down Expand Up @@ -57,27 +49,27 @@ module.exports = function(grunt) {
watch: {
less: {
files: 'src/less/**/*.less',
tasks: ['less:development', 'autoprefixer']
tasks: ['less', 'autoprefixer']
},
tmpl: {
files: 'src/tmpl/**/*.pug',
tasks: ['default']
tasks: ['build']
},
js: {
files: 'src/js/**',
tasks: ['uglify']
},
other: {
files: 'src/img/**',
tasks: ['default']
tasks: ['build']
},
gruntfile: {
files: 'Gruntfile.js',
tasks: ['default']
tasks: ['build']
},
docs: {
files: 'node_modules/grunt-docs/**',
tasks: ['default']
tasks: ['build']
}
},

Expand Down Expand Up @@ -219,32 +211,28 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-puglint');
}

grunt.registerTask('build', 'Build the site', [
grunt.registerTask('build', 'Build the site for production', [
'copy',
'docs',
'blog',
'pug',
'plugins',
'uglify',
'sitemap'
]);
grunt.registerTask('default', 'Build the site, download plugins, production ready', [
'build',
'sitemap',
'downloadPlugins',
'less:production',
'less',
'autoprefixer'
]);

grunt.registerTask('test', [
'build',
'jshint',
'puglint',
// Requires Java 8+
'htmllint'
]);
grunt.registerTask('dev', 'Development Mode', [
'build',
'less:development',
'autoprefixer',
'jshint',
'concurrent'
]);
};
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

53 changes: 19 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,27 @@
# Grunt Website [![Build Status: Linux](https://travis-ci.org/gruntjs/gruntjs.com.svg?branch=master)](https://travis-ci.org/gruntjs/gruntjs.com)
[![Build Status](https://github.com/gruntjs/gruntjs.com/actions/workflows/CI.yaml/badge.svg)](https://github.com/gruntjs/gruntjs.com/actions/workflows/CI.yaml)

## Setup Development
# Grunt Website

1. `npm install`
2. `grunt`
## Local Development

## Tasks
1. Download dependencies:
```shell
npm install
```
2. Create production site:
```shell
npm run build
```
3. Start web server:
```shell
npm start
```

* `grunt build` - Manually Rebuild
* `grunt dev` - Development Mode
Local address is: http://localhost:5678/

## Manually Run Server
To automatically rebuild and restart the server after any file changes,
use the development mode instead:

```shell
npm start
```

Server port is: `5678`.

## Deploy to Heroku

Set Heroku keys (if needed) with

```shell
ssh-keygen -t rsa -C "YOUR_HEROKU_EMAIL" -f ~/.ssh/id_rsa_heroku
ssh-add ~/.ssh/id_rsa_heroku
heroku keys:add ~/.ssh/id_rsa_heroku.pub
```

Push

```shell
git push git@heroku.com:grunt.git master:master
```

If you need to regenerate the Heroku site, use empty commits:

```shell
git commit --allow-empty -m "empty commit"
git push git@heroku.com:grunt.git master:master
npm run dev
```
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
"npm": ">=3"
},
"scripts": {
"postinstall": "grunt build",
"build": "grunt build",
"start": "node server.js",
"postinstall": "grunt",
"test": "grunt test"
"test": "grunt test",
"dev": "grunt dev"
},
"private": true,
"dependencies": {
Expand Down

0 comments on commit c01f3eb

Please sign in to comment.