maglove 1.0.9 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80be4fcc389c5eb11f5e440cb0df7b8598bed7ae
4
- data.tar.gz: f38ee17373a3c0708340ceee7ff7ce2ba64cde41
3
+ metadata.gz: 08ca49391827d294cadcc43751da092f9589bf6c
4
+ data.tar.gz: 8453341f83eef48ef91f0fb9167a80fb50ff72fa
5
5
  SHA512:
6
- metadata.gz: 9db79b23d637c1741e1bd26cdbe56bcb6771190036903d3a748459594452c305f1f00d60fc31f8124c67505207b5df202bbb9fdab76801574b64e25e6499f5b3
7
- data.tar.gz: 2c0cf6cc041b8e451dc9c490621f5879723976508b954fa159fcef859cb0698968a09c1f4880c6452089c82c72c2a338416f460e1b178b6eaadc43ac0f72d8ef
6
+ metadata.gz: b9a1f0373f7954394030aa98b40a139bfc9d276c396c24246b07d2e88be4797f74423c62c3333d69f61573ecb8d75358f6f04fd83c68c2911ba46b9a8541f254
7
+ data.tar.gz: cc5af7486f4601377d25b3c5d43ef590f00b20abd7d1d17375a6d9e391904dc0e36bab2ff6a3dcfb8b2a48e96677f650c0d19fe89d20d006315396d98a390231
data/Gemfile.lock CHANGED
@@ -1,11 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- maglove (1.0.9)
4
+ maglove (1.1.0)
5
5
  actionpack (>= 4.0)
6
6
  activesupport (>= 4.0)
7
7
  bundler (~> 1.10)
8
+ closure-compiler (~> 1.1)
8
9
  coffee-script (~> 2.4)
10
+ crush (~> 0.3)
11
+ cssminify (~> 1.0)
9
12
  dialers (~> 0.2)
10
13
  faye (~> 1.2)
11
14
  filewatcher (~> 0.5)
@@ -51,6 +54,7 @@ GEM
51
54
  public_suffix (~> 2.0, >= 2.0.2)
52
55
  ast (2.3.0)
53
56
  builder (3.2.2)
57
+ closure-compiler (1.1.12)
54
58
  coffee-script (2.4.1)
55
59
  coffee-script-source
56
60
  execjs
@@ -58,6 +62,9 @@ GEM
58
62
  commonjs (0.2.7)
59
63
  concurrent-ruby (1.0.2)
60
64
  cookiejar (0.3.3)
65
+ crush (0.3.3)
66
+ tilt (~> 1.3)
67
+ cssminify (1.0.2)
61
68
  dialers (0.2.2)
62
69
  faraday (~> 0.9)
63
70
  faraday-conductivity (~> 0.3)
@@ -7,6 +7,7 @@ module MagLove
7
7
  def compile
8
8
  invoke(:clean)
9
9
  invoke(:images)
10
+ invoke(:videos)
10
11
  invoke(:javascript)
11
12
  invoke(:stylesheet)
12
13
  invoke(:yaml)
@@ -33,6 +34,15 @@ module MagLove
33
34
  end
34
35
  end
35
36
 
37
+ desc "videos", "Copy videos"
38
+ def videos
39
+ info("▸ Copying Videos")
40
+ theme_dir.files("videos/**/*.{mp4,webm,ogg}").each do |file|
41
+ debug("~> Copying #{file}")
42
+ file.asset(theme: options.theme).write!
43
+ end
44
+ end
45
+
36
46
  desc "imageoptim", "Optimize images"
37
47
  option :percent, type: :numeric, required: true, default: 25
38
48
  def imageoptim
@@ -73,6 +83,17 @@ module MagLove
73
83
  info("▸ Compiling YAML Manifest")
74
84
  theme_dir.file("theme.yml").asset.write!
75
85
  end
86
+
87
+ desc "compress", "Compress Assets for Distribution"
88
+ def compress
89
+ invoke(:javascript)
90
+ invoke(:stylesheet)
91
+
92
+ info("▸ Compressing JavaScript")
93
+ theme_dir(root: "dist").file("theme.js").minify!
94
+ info("▸ Compressing Stylesheet")
95
+ theme_dir(root: "dist").file("theme.css").minify!
96
+ end
76
97
 
77
98
  desc "templates", "Compile HAML Templates"
78
99
  def templates
@@ -55,6 +55,7 @@ module MagLove
55
55
  # invoke asset compilation
56
56
  invoke(Fonts, :compile, [], {})
57
57
  invoke(Assets, :compile, [], { theme: options.theme })
58
+ invoke(Assets, :compress, [], { theme: options.theme })
58
59
 
59
60
  # update theme
60
61
  info("▸ Synchronizing Metadata")
@@ -109,9 +110,10 @@ module MagLove
109
110
  hydra.run
110
111
 
111
112
  # upload css/js
112
- info("▸ Synchronizing JavaScript and Stylesheet")
113
- theme.upload_stylesheet(theme_dir(root: "dist").file("theme.css").to_s)
113
+ info("▸ Synchronizing JavaScript")
114
114
  theme.upload_javascript(theme_dir(root: "dist").file("theme.js").to_s)
115
+ info("▸ Synchronizing Stylesheet")
116
+ theme.upload_stylesheet(theme_dir(root: "dist").file("theme.css").to_s)
115
117
 
116
118
  # upload templates
117
119
  info("▸ Synchronizing Templates")
@@ -19,7 +19,7 @@ module MagLove
19
19
  @output = CoffeeScript.compile(@data, options)
20
20
 
21
21
  # handle includes
22
- @output.gsub(/^include\("([^"]+)"\);$/) do |match|
22
+ @output.gsub!(/^include\("([^"]+)"\);$/) do |match|
23
23
  path = Regexp.last_match[1]
24
24
  path = "#{path}.coffee" if File.extname(path).empty?
25
25
  include_path = File.absolute_path(path, File.dirname(file))
@@ -36,6 +36,8 @@ module MagLove
36
36
  raise "Path not found: #{include_path}"
37
37
  end
38
38
  end
39
+
40
+ @output
39
41
  end
40
42
 
41
43
  def allows_script?
@@ -1,3 +1,3 @@
1
1
  module MagLove
2
- VERSION = "1.0.9"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -1,3 +1,5 @@
1
+ require 'cssminify'
2
+ require 'closure-compiler'
1
3
  require 'workspace/workspace_file/archive'
2
4
  require 'workspace/workspace_file/media'
3
5
  require 'workspace/workspace_file/net'
@@ -104,5 +106,20 @@ module Workspace
104
106
  def size
105
107
  File.size(to_s)
106
108
  end
109
+
110
+ def minify
111
+ if extension == "js"
112
+ set(Closure::Compiler.new.compile(contents))
113
+ elsif extension == "css"
114
+ set(CSSminify.compress(contents))
115
+ end
116
+ self
117
+ end
118
+
119
+ def minify!
120
+ minify.write
121
+ self
122
+ end
123
+
107
124
  end
108
125
  end
data/maglove.gemspec CHANGED
@@ -31,6 +31,9 @@ Gem::Specification.new do |s|
31
31
  s.add_runtime_dependency "dialers", "~> 0.2"
32
32
  s.add_runtime_dependency "rubyzip", "~> 1.1"
33
33
  s.add_runtime_dependency "image_optim", "~> 0.21"
34
+ s.add_runtime_dependency "crush", "~> 0.3"
35
+ s.add_runtime_dependency "closure-compiler", "~> 1.1"
36
+ s.add_runtime_dependency "cssminify", "~> 1.0"
34
37
  s.add_runtime_dependency "image_optim_pack", "~> 0.2"
35
38
  s.add_runtime_dependency "puma", "~> 3.6"
36
39
  s.add_runtime_dependency "filewatcher", "~> 0.5"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maglove
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Strebitzer
@@ -262,6 +262,48 @@ dependencies:
262
262
  - - "~>"
263
263
  - !ruby/object:Gem::Version
264
264
  version: '0.21'
265
+ - !ruby/object:Gem::Dependency
266
+ name: crush
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - "~>"
270
+ - !ruby/object:Gem::Version
271
+ version: '0.3'
272
+ type: :runtime
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - "~>"
277
+ - !ruby/object:Gem::Version
278
+ version: '0.3'
279
+ - !ruby/object:Gem::Dependency
280
+ name: closure-compiler
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - "~>"
284
+ - !ruby/object:Gem::Version
285
+ version: '1.1'
286
+ type: :runtime
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - "~>"
291
+ - !ruby/object:Gem::Version
292
+ version: '1.1'
293
+ - !ruby/object:Gem::Dependency
294
+ name: cssminify
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - "~>"
298
+ - !ruby/object:Gem::Version
299
+ version: '1.0'
300
+ type: :runtime
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - "~>"
305
+ - !ruby/object:Gem::Version
306
+ version: '1.0'
265
307
  - !ruby/object:Gem::Dependency
266
308
  name: image_optim_pack
267
309
  requirement: !ruby/object:Gem::Requirement