ignore old content in development and add html compression
This commit is contained in:
parent
7247fe1df2
commit
e6688019b1
2 changed files with 15 additions and 6 deletions
12
Rules
12
Rules
|
@ -14,7 +14,8 @@ preprocess do
|
|||
`npm install`
|
||||
|
||||
# We don't want to compile old blogposts in development
|
||||
ignore_old_blogposts if development?
|
||||
ignore_old_content('blog', 'events', 'about/verslagen') if development?
|
||||
|
||||
update_blog_attributes
|
||||
create_yearly_items('Blog')
|
||||
create_yearly_items('Events')
|
||||
|
@ -44,6 +45,8 @@ compile '/blog/*' do
|
|||
layout '/generic.*'
|
||||
layout '/default.*'
|
||||
filter :erb
|
||||
|
||||
filter :html_press
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -56,6 +59,8 @@ compile '/events/*' do
|
|||
layout '/generic.*'
|
||||
layout '/default.*'
|
||||
filter :erb
|
||||
|
||||
filter :html_press
|
||||
end
|
||||
|
||||
compile '/events/*/*' do
|
||||
|
@ -65,6 +70,8 @@ compile '/events/*/*' do
|
|||
layout '/eventpost.*'
|
||||
layout '/default.*'
|
||||
filter :erb
|
||||
|
||||
filter :html_press
|
||||
end
|
||||
|
||||
compile '/events/*/*', rep: :text do
|
||||
|
@ -91,6 +98,7 @@ compile '/blog/*/*.md' do
|
|||
layout '/default.*'
|
||||
filter :erb
|
||||
|
||||
filter :html_press
|
||||
end
|
||||
|
||||
compile '/blog/*/*.md', rep: :text do
|
||||
|
@ -140,6 +148,8 @@ compile '/**/*.erb' do
|
|||
|
||||
layout '/generic.*'
|
||||
layout '/default.*'
|
||||
|
||||
filter :html_press
|
||||
end
|
||||
|
||||
compile '/**/*.md' do
|
||||
|
|
|
@ -18,12 +18,11 @@ module PreprocessHelper
|
|||
end
|
||||
end
|
||||
|
||||
def ignore_old_blogposts
|
||||
def ignore_old_content(*paths)
|
||||
@items.delete_if do |item|
|
||||
path = item.identifier.to_s
|
||||
next unless path.start_with?('/blog/')
|
||||
year = path.gsub(%r{/blog/(\d\d)-\d\d/.*}, '\1').to_i
|
||||
year < 16
|
||||
next unless item.identifier.match?(%r{^/(#{paths.join('|')})/})
|
||||
year = item.identifier.to_s.match(%r{/(\d\d-\d\d)/})[1]
|
||||
year != @config[:academic_year]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue