Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Go back to running all this junk with rake tasks instead of relying o…
…n just Grunt.
- Loading branch information
1 parent
d1b6fc1
commit 85120d7
Showing
6 changed files
with
53 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,49 @@ | ||
# Static Site Starter | ||
|
||
A skeleton for quickly starting a new static site. It uses [Grunt](http://gruntjs.com/) to run all of the following tasks: [Jekyll](http://jekyllrb.com/) to generate static pages and run a web server, [SASS](http://sass-lang.com/)/[Bourbon](http://bourbon.io/) to facilitate rapid CSS, and Grunt concatenates and minifies JS files, compresses images and reloads the browser when changes are detected. | ||
A skeleton for quickly starting a new static site. It uses [Grunt](http://gruntjs.com/) to concatenate and minify JS files, compress images and recompile assets when changes are detected, [SASS](http://sass-lang.com/)/[Bourbon](http://bourbon.io/) to facilitate rapid CSS, and [Jekyll](http://jekyllrb.com/) to generate static pages and run a web server. | ||
|
||
## Installing Dependencies | ||
|
||
You need to have Ruby and Node JS installed for the dependencies to work. If you're running OSX you most likely have Ruby installed already. If not, or if you need the latest and greatest, go [here](https://www.ruby-lang.org/en/downloads/). Installers for Node JS can be found [here](http://nodejs.org/download/). | ||
|
||
### Installing Jekyll & SASS using Bundler: | ||
### Installing Grunt: | ||
|
||
```shell | ||
npm install -g grunt-cli | ||
``` | ||
|
||
### Installing Jekyll, SASS & Grunt modules the easy way: | ||
|
||
```shell | ||
cd static-site-starter | ||
bundle install | ||
rake install | ||
``` | ||
|
||
### Installing Jekyll & SASS without Bundler: | ||
### Installing Jekyll, SASS & Grunt modules individually: | ||
|
||
```shell | ||
cd static-site-starter | ||
gem install jekyll | ||
gem install sass | ||
npm install | ||
``` | ||
|
||
### Installing Grunt: | ||
## Watching files and running a server for development | ||
|
||
```shell | ||
npm install -g grunt-cli | ||
rake serve | ||
``` | ||
|
||
### Installing Grunt modules: | ||
This will run a server for the project that can be accessed at [http://localhost:4000](http://localhost:4000). Changes to files will tell Jekyll/Grunt to automatically rebuild the site. Grunt will also run and compile SASS to CSS, compress images, compile/minify JS and compress images when it detects changes to any of these types of files. | ||
|
||
```shell | ||
cd static-site-starter | ||
npm install | ||
``` | ||
FYI, Grunt and Jekyll don't play nice together sometimes, especially upon initial startup of the server. You're likely to see an unstyled page because the site has been compiled before the assets could be. Just change something and the resulting recompile should make everything fine. | ||
|
||
## Watching files and running a server | ||
## Just building the site | ||
|
||
```shell | ||
grunt | ||
rake build | ||
``` | ||
|
||
This will run a server for the project that can be accessed at [http://localhost:4000](http://localhost:4000). Changes to files will tell Jekyll/Grunt to automatically rebuild the site. Grunt will also run and compile SASS to CSS, compress images, compile/minify JS and compress images when it detects changes to any of these types of files. | ||
If you're just looking for a quick static build of your project files this will run Grunt to compile all assets and then build the site to the /_site directory with Jekyll. | ||
|
||
This doesn't seem to suffer from the uncompiled assets problem that running a server does because Jekyll specifically doesn't compile until Grunt has finished. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
desc "Installs all dependencies." | ||
task :install do | ||
puts "Installing dependencies" | ||
system "bundle install" | ||
system "npm install" | ||
end | ||
|
||
desc "Runs Grunt to compile assets, compiles Jekyll site." | ||
task :build do | ||
puts "Running Grunt tasks and compiling Jekyll site." | ||
system "grunt:build" | ||
system "jekyll build" | ||
end | ||
|
||
desc "Runs Grunt to compile assets and watch for changes, starts Jekyll server." | ||
task :serve do | ||
puts "Running Grunt tasks and watching for changes, starting the Jekyll server." | ||
gruntWatchPid = Process.spawn("grunt") | ||
jekyllServePid = Process.spawn("jekyll serve --watch") | ||
trap("INT") { | ||
[gruntWatchPid, jekyllServePid].each { |pid| Process.kill(9, pid) rescue Errno::ESRCH } | ||
exit 0 | ||
} | ||
[gruntWatchPid, jekyllServePid].each { |pid| Process.wait(pid) } | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.