make development faster by not compiling literally everything
This commit is contained in:
parent
2a6bab556b
commit
9df7c78046
4 changed files with 25 additions and 16 deletions
|
@ -14,7 +14,7 @@ before_install:
|
||||||
- echo -e "Host zeus.ugent.be\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
- echo -e "Host zeus.ugent.be\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
||||||
- npm install
|
- npm install
|
||||||
script:
|
script:
|
||||||
- bundle exec nanoc
|
- ZEUS_PRODUCTION=1 bundle exec nanoc
|
||||||
- bundle exec nanoc check --deploy
|
- bundle exec nanoc check --deploy
|
||||||
after_success:
|
after_success:
|
||||||
- mv deploy_key ~/.ssh/id_rsa
|
- mv deploy_key ~/.ssh/id_rsa
|
||||||
|
|
29
Rules
29
Rules
|
@ -13,6 +13,17 @@ require 'icalendar'
|
||||||
preprocess do
|
preprocess do
|
||||||
`npm install`
|
`npm install`
|
||||||
|
|
||||||
|
# We don't want to compile old blogposts in development
|
||||||
|
if development?
|
||||||
|
@items.delete_if do |item|
|
||||||
|
ident = item.identifier.to_s
|
||||||
|
|
||||||
|
next unless ident.to_s.start_with?('/posts/')
|
||||||
|
|
||||||
|
!ident.start_with?('/posts/16-17/')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@items.find_all('/posts/**/*').each do |i|
|
@items.find_all('/posts/**/*').each do |i|
|
||||||
year_str = %r{/(\d\d)-\d\d/}.match(i.identifier).captures[0]
|
year_str = %r{/(\d\d)-\d\d/}.match(i.identifier).captures[0]
|
||||||
academic_year = year_str.to_i
|
academic_year = year_str.to_i
|
||||||
|
@ -66,8 +77,6 @@ compile '/blog/*' do
|
||||||
layout '/generic.*'
|
layout '/generic.*'
|
||||||
layout '/default.*'
|
layout '/default.*'
|
||||||
filter :erb
|
filter :erb
|
||||||
|
|
||||||
filter :relativize_paths, type: :html
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -79,8 +88,6 @@ compile '/events/**/*' do
|
||||||
layout '/eventpost.*'
|
layout '/eventpost.*'
|
||||||
layout '/default.*'
|
layout '/default.*'
|
||||||
filter :erb
|
filter :erb
|
||||||
|
|
||||||
filter :relativize_paths, type: :html
|
|
||||||
end
|
end
|
||||||
|
|
||||||
compile '/events/**/*', rep: :text do
|
compile '/events/**/*', rep: :text do
|
||||||
|
@ -104,8 +111,6 @@ compile '/posts/**/*' do
|
||||||
layout '/blogpost.*'
|
layout '/blogpost.*'
|
||||||
layout '/generic.*'
|
layout '/generic.*'
|
||||||
layout '/default.*'
|
layout '/default.*'
|
||||||
|
|
||||||
filter :relativize_paths, type: :html
|
|
||||||
end
|
end
|
||||||
|
|
||||||
compile '/posts/**/*', rep: :text do
|
compile '/posts/**/*', rep: :text do
|
||||||
|
@ -119,7 +124,6 @@ end
|
||||||
#
|
#
|
||||||
compile '/projects/*' do
|
compile '/projects/*' do
|
||||||
filter :kramdown
|
filter :kramdown
|
||||||
filter :relativize_paths, type: :html
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -132,14 +136,13 @@ end
|
||||||
|
|
||||||
compile '/**/*.ics' do
|
compile '/**/*.ics' do
|
||||||
filter :erb
|
filter :erb
|
||||||
|
write @item.identifier.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
compile '/*.erb' do
|
compile '/*.erb' do
|
||||||
layout '/generic.*'
|
layout '/generic.*'
|
||||||
layout '/default.*'
|
layout '/default.*'
|
||||||
filter :erb
|
filter :erb
|
||||||
|
|
||||||
filter :relativize_paths, type: :html
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -153,7 +156,7 @@ ignore '/assets/stylesheets/includes/**/*'
|
||||||
|
|
||||||
compile '/assets/stylesheets/**/*.scss' do
|
compile '/assets/stylesheets/**/*.scss' do
|
||||||
filter :sass, syntax: :scss
|
filter :sass, syntax: :scss
|
||||||
filter :autoprefixer
|
filter :autoprefixer if production?
|
||||||
end
|
end
|
||||||
|
|
||||||
passthrough '/assets/images/*.{png,svg}'
|
passthrough '/assets/images/*.{png,svg}'
|
||||||
|
@ -176,7 +179,7 @@ route '/assets/scripts/**/*' do
|
||||||
"#{item.identifier.without_ext}.js"
|
"#{item.identifier.without_ext}.js"
|
||||||
end
|
end
|
||||||
|
|
||||||
# POSTS
|
# EVENTS
|
||||||
route '/events/**/*', rep: :ical do
|
route '/events/**/*', rep: :ical do
|
||||||
"#{item.identifier.without_ext}.ics"
|
"#{item.identifier.without_ext}.ics"
|
||||||
end
|
end
|
||||||
|
@ -189,10 +192,6 @@ route '/**/*.{erb,html,md}' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
route '/**/*' do
|
|
||||||
item.identifier.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# LAYOUTS
|
# LAYOUTS
|
||||||
|
|
9
lib/helpers/environment.rb
Normal file
9
lib/helpers/environment.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module EnvironmentHelper
|
||||||
|
def production?
|
||||||
|
ENV['ZEUS_PRODUCTION']
|
||||||
|
end
|
||||||
|
|
||||||
|
def development?
|
||||||
|
!production?
|
||||||
|
end
|
||||||
|
end
|
|
@ -4,6 +4,7 @@ include Nanoc::Helpers::LinkTo
|
||||||
include Nanoc::Helpers::Rendering
|
include Nanoc::Helpers::Rendering
|
||||||
include Nanoc::Helpers::Text
|
include Nanoc::Helpers::Text
|
||||||
|
|
||||||
|
include EnvironmentHelper
|
||||||
include ArchiveHelper
|
include ArchiveHelper
|
||||||
include AssetHelper
|
include AssetHelper
|
||||||
include EventsHelper
|
include EventsHelper
|
||||||
|
|
Loading…
Reference in a new issue