middleman-more 3.0.14 → 3.1.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. data/features/asset_hash.feature +29 -0
  2. data/features/clean_build.feature +3 -3
  3. data/features/helpers_link_to.feature +4 -4
  4. data/features/i18n_force_locale.feature +13 -0
  5. data/features/i18n_preview.feature +14 -1
  6. data/features/markdown.feature +3 -2
  7. data/features/markdown_redcarpet.feature +21 -0
  8. data/features/markdown_redcarpet_in_haml.feature +42 -0
  9. data/features/minify_javascript.feature +2 -2
  10. data/features/partials_dir.feature +30 -0
  11. data/features/sass-assets-paths.feature +1 -1
  12. data/fixtures/default-partials-dir-app/source/_partial.html.erb +1 -0
  13. data/fixtures/default-partials-dir-app/source/index.html.erb +2 -0
  14. data/fixtures/i18n-default-app/locales/en.yml +4 -0
  15. data/fixtures/i18n-default-app/locales/es.yml +8 -0
  16. data/fixtures/i18n-default-app/source/localizable/index.html.erb +5 -0
  17. data/fixtures/i18n-force-locale/config.rb +13 -0
  18. data/fixtures/i18n-force-locale/locales/en.yml +3 -0
  19. data/fixtures/i18n-force-locale/locales/es.yml +3 -0
  20. data/fixtures/i18n-force-locale/locales/fr.yml +3 -0
  21. data/fixtures/i18n-force-locale/source/index.haml +2 -0
  22. data/fixtures/markdown-app/config.rb +1 -0
  23. data/fixtures/markdown-frontmatter-options-app/config.rb +1 -0
  24. data/fixtures/markdown-frontmatter-options-app/source/smarty_pants-default.html.markdown +5 -0
  25. data/fixtures/markdown-frontmatter-options-app/source/smarty_pants-off.html.markdown +7 -0
  26. data/fixtures/markdown-frontmatter-options-app/source/smarty_pants-on.html.markdown +7 -0
  27. data/fixtures/markdown-frontmatter-options-app/source/tables-default.html.markdown +8 -0
  28. data/fixtures/markdown-frontmatter-options-app/source/tables-off.html.markdown +10 -0
  29. data/fixtures/markdown-frontmatter-options-app/source/tables-on.html.markdown +10 -0
  30. data/{lib/middleman-more/templates/smacss/source/stylesheets/_0.site-settings.scss → fixtures/markdown-in-haml-app/config.rb} +0 -0
  31. data/fixtures/markdown-in-haml-app/source/images/blank.gif +0 -0
  32. data/fixtures/markdown-in-haml-app/source/link_target.html.markdown +4 -0
  33. data/fixtures/partials-dir-app/source/index.html.erb +2 -0
  34. data/fixtures/partials-dir-app/source/nested/partials/_partial.html.erb +1 -0
  35. data/fixtures/partials-dir-app/source/partials/_partial.html.erb +1 -0
  36. data/fixtures/sass-assets-path-app/assets/stylesheets/{_shared-asset.sass → _shared-asset-sass.sass} +1 -1
  37. data/fixtures/sass-assets-path-app/source/stylesheets/plain.css.sass +1 -1
  38. data/lib/middleman-more/core_extensions/compass.rb +22 -22
  39. data/lib/middleman-more/core_extensions/default_helpers.rb +36 -13
  40. data/lib/middleman-more/core_extensions/i18n.rb +31 -6
  41. data/lib/middleman-more/extensions/asset_hash.rb +30 -17
  42. data/lib/middleman-more/extensions/asset_host.rb +11 -8
  43. data/lib/middleman-more/extensions/automatic_image_sizes.rb +4 -8
  44. data/lib/middleman-more/extensions/directory_indexes.rb +2 -5
  45. data/lib/middleman-more/extensions/gzip.rb +18 -19
  46. data/lib/middleman-more/extensions/minify_css.rb +11 -4
  47. data/lib/middleman-more/extensions/minify_javascript.rb +1 -1
  48. data/lib/middleman-more/templates/smacss/source/_footer.haml +1 -1
  49. data/lib/middleman-more/templates/smacss/source/stylesheets/base/README.markdown +11 -0
  50. data/lib/middleman-more/templates/smacss/source/stylesheets/base/base.scss +1 -0
  51. data/lib/middleman-more/templates/smacss/source/stylesheets/base/normalize.scss +375 -0
  52. data/lib/middleman-more/templates/smacss/source/stylesheets/layout/README.markdown +9 -0
  53. data/lib/middleman-more/templates/smacss/source/stylesheets/modules/README.markdown +9 -0
  54. data/lib/middleman-more/templates/smacss/source/stylesheets/states/README.markdown +12 -0
  55. data/lib/middleman-more/templates/smacss/source/stylesheets/style.css.scss +12 -7
  56. data/lib/middleman-more.rb +1 -5
  57. data/middleman-more.gemspec +3 -4
  58. metadata +75 -50
  59. data/lib/middleman-more/core_extensions/assets.rb +0 -43
  60. data/lib/middleman-more/extensions/minify_css/rainpress.rb +0 -168
  61. data/lib/middleman-more/templates/smacss/source/stylesheets/_1.base.scss +0 -2
  62. data/lib/middleman-more/templates/smacss/source/stylesheets/_2.layout.scss +0 -2
  63. data/lib/middleman-more/templates/smacss/source/stylesheets/_3.states.scss +0 -2
  64. data/lib/middleman-more/templates/smacss/source/stylesheets/_4.themes.scss +0 -2
  65. data/lib/middleman-more/templates/smacss/source/stylesheets/modules/_btn.scss +0 -2
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-more
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.14
5
- prerelease:
4
+ version: 3.1.0.beta.1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Thomas Reynolds
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-12 00:00:00.000000000 Z
13
+ date: 2013-04-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: middleman-core
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 3.0.14
22
+ version: 3.1.0.beta.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - '='
29
29
  - !ruby/object:Gem::Version
30
- version: 3.0.14
30
+ version: 3.1.0.beta.1
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: uglifier
33
33
  requirement: !ruby/object:Gem::Requirement
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: 1.2.6
38
+ version: 1.3.0
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: 1.2.6
46
+ version: 1.3.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: haml
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -108,22 +108,6 @@ dependencies:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: 2.2.0
111
- - !ruby/object:Gem::Dependency
112
- name: coffee-script-source
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ~>
117
- - !ruby/object:Gem::Version
118
- version: 1.3.3
119
- type: :runtime
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ~>
125
- - !ruby/object:Gem::Version
126
- version: 1.3.3
127
111
  - !ruby/object:Gem::Dependency
128
112
  name: execjs
129
113
  requirement: !ruby/object:Gem::Requirement
@@ -141,13 +125,13 @@ dependencies:
141
125
  - !ruby/object:Gem::Version
142
126
  version: 1.4.0
143
127
  - !ruby/object:Gem::Dependency
144
- name: maruku
128
+ name: kramdown
145
129
  requirement: !ruby/object:Gem::Requirement
146
130
  none: false
147
131
  requirements:
148
132
  - - ~>
149
133
  - !ruby/object:Gem::Version
150
- version: 0.6.0
134
+ version: 1.0.0
151
135
  type: :runtime
152
136
  prerelease: false
153
137
  version_requirements: !ruby/object:Gem::Requirement
@@ -155,7 +139,7 @@ dependencies:
155
139
  requirements:
156
140
  - - ~>
157
141
  - !ruby/object:Gem::Version
158
- version: 0.6.0
142
+ version: 1.0.0
159
143
  - !ruby/object:Gem::Dependency
160
144
  name: i18n
161
145
  requirement: !ruby/object:Gem::Requirement
@@ -163,10 +147,7 @@ dependencies:
163
147
  requirements:
164
148
  - - ~>
165
149
  - !ruby/object:Gem::Version
166
- version: 0.6.0
167
- - - <
168
- - !ruby/object:Gem::Version
169
- version: 0.6.2
150
+ version: 0.6.4
170
151
  type: :runtime
171
152
  prerelease: false
172
153
  version_requirements: !ruby/object:Gem::Requirement
@@ -174,10 +155,7 @@ dependencies:
174
155
  requirements:
175
156
  - - ~>
176
157
  - !ruby/object:Gem::Version
177
- version: 0.6.0
178
- - - <
179
- - !ruby/object:Gem::Version
180
- version: 0.6.2
158
+ version: 0.6.4
181
159
  - !ruby/object:Gem::Dependency
182
160
  name: padrino-helpers
183
161
  requirement: !ruby/object:Gem::Requirement
@@ -231,6 +209,7 @@ files:
231
209
  - features/helpers_page_classes.feature
232
210
  - features/helpers_url_for.feature
233
211
  - features/i18n_builder.feature
212
+ - features/i18n_force_locale.feature
234
213
  - features/i18n_preview.feature
235
214
  - features/ignore.feature
236
215
  - features/ignore_already_minified.feature
@@ -239,10 +218,12 @@ files:
239
218
  - features/liquid.feature
240
219
  - features/markdown.feature
241
220
  - features/markdown_redcarpet.feature
221
+ - features/markdown_redcarpet_in_haml.feature
242
222
  - features/minify_css.feature
243
223
  - features/minify_javascript.feature
244
224
  - features/nested_layouts.feature
245
225
  - features/partials.feature
226
+ - features/partials_dir.feature
246
227
  - features/relative_assets.feature
247
228
  - features/sass-assets-paths.feature
248
229
  - features/sass_cache_path.feature
@@ -327,6 +308,8 @@ files:
327
308
  - fixtures/content-for-app/source/content_for_haml.html.haml
328
309
  - fixtures/content-for-app/source/content_for_slim.html.slim
329
310
  - fixtures/content-for-app/source/layouts/content_for.erb
311
+ - fixtures/default-partials-dir-app/source/_partial.html.erb
312
+ - fixtures/default-partials-dir-app/source/index.html.erb
330
313
  - fixtures/different-engine-partial/config.rb
331
314
  - fixtures/different-engine-partial/source/index.html.erb
332
315
  - fixtures/different-engine-partial/source/layouts/layout.erb
@@ -354,6 +337,14 @@ files:
354
337
  - fixtures/i18n-alt-root-app/source/lang_data/hello.html.erb
355
338
  - fixtures/i18n-alt-root-app/source/lang_data/index.html.erb
356
339
  - fixtures/i18n-alt-root-app/source/layout.erb
340
+ - fixtures/i18n-default-app/locales/en.yml
341
+ - fixtures/i18n-default-app/locales/es.yml
342
+ - fixtures/i18n-default-app/source/localizable/index.html.erb
343
+ - fixtures/i18n-force-locale/config.rb
344
+ - fixtures/i18n-force-locale/locales/en.yml
345
+ - fixtures/i18n-force-locale/locales/es.yml
346
+ - fixtures/i18n-force-locale/locales/fr.yml
347
+ - fixtures/i18n-force-locale/source/index.haml
357
348
  - fixtures/i18n-test-app/locales/en.yml
358
349
  - fixtures/i18n-test-app/locales/es.yml
359
350
  - fixtures/i18n-test-app/source/layout.erb
@@ -411,6 +402,16 @@ files:
411
402
  - fixtures/markdown-app/source/superscript.html.markdown
412
403
  - fixtures/markdown-app/source/tables.html.markdown
413
404
  - fixtures/markdown-app/source/with_toc_data.html.markdown
405
+ - fixtures/markdown-frontmatter-options-app/config.rb
406
+ - fixtures/markdown-frontmatter-options-app/source/smarty_pants-default.html.markdown
407
+ - fixtures/markdown-frontmatter-options-app/source/smarty_pants-off.html.markdown
408
+ - fixtures/markdown-frontmatter-options-app/source/smarty_pants-on.html.markdown
409
+ - fixtures/markdown-frontmatter-options-app/source/tables-default.html.markdown
410
+ - fixtures/markdown-frontmatter-options-app/source/tables-off.html.markdown
411
+ - fixtures/markdown-frontmatter-options-app/source/tables-on.html.markdown
412
+ - fixtures/markdown-in-haml-app/config.rb
413
+ - fixtures/markdown-in-haml-app/source/images/blank.gif
414
+ - fixtures/markdown-in-haml-app/source/link_target.html.markdown
414
415
  - fixtures/minify-css-app/source/inline-css.html.haml
415
416
  - fixtures/minify-css-app/source/more-css/site.css
416
417
  - fixtures/minify-css-app/source/stylesheets/report.css
@@ -456,6 +457,9 @@ files:
456
457
  - fixtures/partials-app/source/sub/_local.erb
457
458
  - fixtures/partials-app/source/sub/index.html.erb
458
459
  - fixtures/partials-app/source/using_snippet.html.erb
460
+ - fixtures/partials-dir-app/source/index.html.erb
461
+ - fixtures/partials-dir-app/source/nested/partials/_partial.html.erb
462
+ - fixtures/partials-dir-app/source/partials/_partial.html.erb
459
463
  - fixtures/passthrough-app/source/.htaccess
460
464
  - fixtures/passthrough-app/source/inline-coffeescript.html.haml
461
465
  - fixtures/passthrough-app/source/inline-css.html.haml
@@ -479,7 +483,7 @@ files:
479
483
  - fixtures/relative-assets-app/source/img/blank.gif
480
484
  - fixtures/relative-assets-app/source/relative_image.html.erb
481
485
  - fixtures/relative-assets-app/source/stylesheets/relative_assets.css.sass
482
- - fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset.sass
486
+ - fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset-sass.sass
483
487
  - fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset.scss
484
488
  - fixtures/sass-assets-path-app/config.rb
485
489
  - fixtures/sass-assets-path-app/my-vendor/stylesheets/_partial.sass
@@ -606,7 +610,6 @@ files:
606
610
  - fixtures/wildcard-directory-index-app/source/layouts/admin.erb
607
611
  - fixtures/wildcard-directory-index-app/source/layouts/layout.erb
608
612
  - lib/middleman-more.rb
609
- - lib/middleman-more/core_extensions/assets.rb
610
613
  - lib/middleman-more/core_extensions/compass.rb
611
614
  - lib/middleman-more/core_extensions/default_helpers.rb
612
615
  - lib/middleman-more/core_extensions/i18n.rb
@@ -619,19 +622,18 @@ files:
619
622
  - lib/middleman-more/extensions/gzip.rb
620
623
  - lib/middleman-more/extensions/lorem.rb
621
624
  - lib/middleman-more/extensions/minify_css.rb
622
- - lib/middleman-more/extensions/minify_css/rainpress.rb
623
625
  - lib/middleman-more/extensions/minify_javascript.rb
624
626
  - lib/middleman-more/extensions/relative_assets.rb
625
627
  - lib/middleman-more/templates/smacss.rb
626
628
  - lib/middleman-more/templates/smacss/source/_footer.haml
627
629
  - lib/middleman-more/templates/smacss/source/index.html.haml
628
630
  - lib/middleman-more/templates/smacss/source/layouts/layout.haml
629
- - lib/middleman-more/templates/smacss/source/stylesheets/_0.site-settings.scss
630
- - lib/middleman-more/templates/smacss/source/stylesheets/_1.base.scss
631
- - lib/middleman-more/templates/smacss/source/stylesheets/_2.layout.scss
632
- - lib/middleman-more/templates/smacss/source/stylesheets/_3.states.scss
633
- - lib/middleman-more/templates/smacss/source/stylesheets/_4.themes.scss
634
- - lib/middleman-more/templates/smacss/source/stylesheets/modules/_btn.scss
631
+ - lib/middleman-more/templates/smacss/source/stylesheets/base/README.markdown
632
+ - lib/middleman-more/templates/smacss/source/stylesheets/base/base.scss
633
+ - lib/middleman-more/templates/smacss/source/stylesheets/base/normalize.scss
634
+ - lib/middleman-more/templates/smacss/source/stylesheets/layout/README.markdown
635
+ - lib/middleman-more/templates/smacss/source/stylesheets/modules/README.markdown
636
+ - lib/middleman-more/templates/smacss/source/stylesheets/states/README.markdown
635
637
  - lib/middleman-more/templates/smacss/source/stylesheets/style.css.scss
636
638
  - lib/middleman_extension.rb
637
639
  - middleman-more.gemspec
@@ -652,16 +654,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
652
654
  version: '0'
653
655
  segments:
654
656
  - 0
655
- hash: 4507811237131658787
657
+ hash: -1915495170693894069
656
658
  required_rubygems_version: !ruby/object:Gem::Requirement
657
659
  none: false
658
660
  requirements:
659
- - - ! '>='
661
+ - - ! '>'
660
662
  - !ruby/object:Gem::Version
661
- version: '0'
662
- segments:
663
- - 0
664
- hash: 4507811237131658787
663
+ version: 1.3.1
665
664
  requirements: []
666
665
  rubyforge_project:
667
666
  rubygems_version: 1.8.24
@@ -692,6 +691,7 @@ test_files:
692
691
  - features/helpers_page_classes.feature
693
692
  - features/helpers_url_for.feature
694
693
  - features/i18n_builder.feature
694
+ - features/i18n_force_locale.feature
695
695
  - features/i18n_preview.feature
696
696
  - features/ignore.feature
697
697
  - features/ignore_already_minified.feature
@@ -700,10 +700,12 @@ test_files:
700
700
  - features/liquid.feature
701
701
  - features/markdown.feature
702
702
  - features/markdown_redcarpet.feature
703
+ - features/markdown_redcarpet_in_haml.feature
703
704
  - features/minify_css.feature
704
705
  - features/minify_javascript.feature
705
706
  - features/nested_layouts.feature
706
707
  - features/partials.feature
708
+ - features/partials_dir.feature
707
709
  - features/relative_assets.feature
708
710
  - features/sass-assets-paths.feature
709
711
  - features/sass_cache_path.feature
@@ -788,6 +790,8 @@ test_files:
788
790
  - fixtures/content-for-app/source/content_for_haml.html.haml
789
791
  - fixtures/content-for-app/source/content_for_slim.html.slim
790
792
  - fixtures/content-for-app/source/layouts/content_for.erb
793
+ - fixtures/default-partials-dir-app/source/_partial.html.erb
794
+ - fixtures/default-partials-dir-app/source/index.html.erb
791
795
  - fixtures/different-engine-partial/config.rb
792
796
  - fixtures/different-engine-partial/source/index.html.erb
793
797
  - fixtures/different-engine-partial/source/layouts/layout.erb
@@ -815,6 +819,14 @@ test_files:
815
819
  - fixtures/i18n-alt-root-app/source/lang_data/hello.html.erb
816
820
  - fixtures/i18n-alt-root-app/source/lang_data/index.html.erb
817
821
  - fixtures/i18n-alt-root-app/source/layout.erb
822
+ - fixtures/i18n-default-app/locales/en.yml
823
+ - fixtures/i18n-default-app/locales/es.yml
824
+ - fixtures/i18n-default-app/source/localizable/index.html.erb
825
+ - fixtures/i18n-force-locale/config.rb
826
+ - fixtures/i18n-force-locale/locales/en.yml
827
+ - fixtures/i18n-force-locale/locales/es.yml
828
+ - fixtures/i18n-force-locale/locales/fr.yml
829
+ - fixtures/i18n-force-locale/source/index.haml
818
830
  - fixtures/i18n-test-app/locales/en.yml
819
831
  - fixtures/i18n-test-app/locales/es.yml
820
832
  - fixtures/i18n-test-app/source/layout.erb
@@ -872,6 +884,16 @@ test_files:
872
884
  - fixtures/markdown-app/source/superscript.html.markdown
873
885
  - fixtures/markdown-app/source/tables.html.markdown
874
886
  - fixtures/markdown-app/source/with_toc_data.html.markdown
887
+ - fixtures/markdown-frontmatter-options-app/config.rb
888
+ - fixtures/markdown-frontmatter-options-app/source/smarty_pants-default.html.markdown
889
+ - fixtures/markdown-frontmatter-options-app/source/smarty_pants-off.html.markdown
890
+ - fixtures/markdown-frontmatter-options-app/source/smarty_pants-on.html.markdown
891
+ - fixtures/markdown-frontmatter-options-app/source/tables-default.html.markdown
892
+ - fixtures/markdown-frontmatter-options-app/source/tables-off.html.markdown
893
+ - fixtures/markdown-frontmatter-options-app/source/tables-on.html.markdown
894
+ - fixtures/markdown-in-haml-app/config.rb
895
+ - fixtures/markdown-in-haml-app/source/images/blank.gif
896
+ - fixtures/markdown-in-haml-app/source/link_target.html.markdown
875
897
  - fixtures/minify-css-app/source/inline-css.html.haml
876
898
  - fixtures/minify-css-app/source/more-css/site.css
877
899
  - fixtures/minify-css-app/source/stylesheets/report.css
@@ -917,6 +939,9 @@ test_files:
917
939
  - fixtures/partials-app/source/sub/_local.erb
918
940
  - fixtures/partials-app/source/sub/index.html.erb
919
941
  - fixtures/partials-app/source/using_snippet.html.erb
942
+ - fixtures/partials-dir-app/source/index.html.erb
943
+ - fixtures/partials-dir-app/source/nested/partials/_partial.html.erb
944
+ - fixtures/partials-dir-app/source/partials/_partial.html.erb
920
945
  - fixtures/passthrough-app/source/.htaccess
921
946
  - fixtures/passthrough-app/source/inline-coffeescript.html.haml
922
947
  - fixtures/passthrough-app/source/inline-css.html.haml
@@ -940,7 +965,7 @@ test_files:
940
965
  - fixtures/relative-assets-app/source/img/blank.gif
941
966
  - fixtures/relative-assets-app/source/relative_image.html.erb
942
967
  - fixtures/relative-assets-app/source/stylesheets/relative_assets.css.sass
943
- - fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset.sass
968
+ - fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset-sass.sass
944
969
  - fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset.scss
945
970
  - fixtures/sass-assets-path-app/config.rb
946
971
  - fixtures/sass-assets-path-app/my-vendor/stylesheets/_partial.sass
@@ -1,43 +0,0 @@
1
- module Middleman
2
- module CoreExtensions
3
-
4
- # Base helper to manipulate asset paths
5
- module Assets
6
-
7
- # Extension registered
8
- class << self
9
- def registered(app)
10
- # Disable Padrino cache buster
11
- app.set :asset_stamp, false
12
-
13
- # Include helpers
14
- app.send :include, InstanceMethod
15
- end
16
- alias :included :registered
17
- end
18
-
19
- # Methods to be mixed-in to Middleman::Application
20
- module InstanceMethod
21
-
22
- # Get the URL of an asset given a type/prefix
23
- #
24
- # @param [String] path The path (such as "photo.jpg")
25
- # @param [String] prefix The type prefix (such as "images")
26
- # @return [String] The fully qualified asset url
27
- def asset_url(path, prefix="")
28
- # Don't touch assets which already have a full path
29
- if path.include?("//")
30
- path
31
- else # rewrite paths to use their destination path
32
- path = File.join(prefix, path)
33
- if resource = sitemap.find_resource_by_path(path)
34
- resource.url
35
- else
36
- File.join(http_prefix, path)
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,168 +0,0 @@
1
- # == Information
2
- #
3
- # This is the main class of Rainpress, create an instance of it to compress
4
- # your CSS-styles.
5
- #
6
- # Author:: Uwe L. Korn <uwelk@xhochy.org>
7
- #
8
- # <b>Options:</b>
9
- #
10
- # * <tt>:comments</tt> - if set to false, comments will not be removed
11
- # * <tt>:newlines</tt> - if set to false, newlines will not be removed
12
- # * <tt>:spaces</tt> - if set to false, spaces will not be removed
13
- # * <tt>:colors</tt> - if set to false, colors will not be modified
14
- # * <tt>:misc</tt> - if set to false, miscellaneous compression parts will be skipped
15
- class Rainpress
16
- # Quick-compress the styles.
17
- # This eliminates the need to create an instance of the class
18
- def self.compress(style, options = {})
19
- self.new(style, options).compress!
20
- end
21
-
22
- def initialize(style, opts = {})
23
- @style = style
24
- @opts = {
25
- :comments => true,
26
- :newlines => true,
27
- :spaces => true,
28
- :colors => false,
29
- :misc => true
30
- }
31
- @opts.merge! opts
32
- end
33
-
34
- # Run the compressions and return the newly compressed text
35
- def compress!
36
- remove_comments! if @opts[:comments]
37
- remove_newlines! if @opts[:newlines]
38
- remove_spaces! if @opts[:spaces]
39
- shorten_colors! if @opts[:colors]
40
- do_misc! if @opts[:misc]
41
- @style
42
- end
43
-
44
- # Remove all comments out of the CSS-Document
45
- #
46
- # Only /* text */ comments are supported.
47
- # Attention: If you are doing css hacks for IE using the comment tricks,
48
- # they will be removed using this function. Please consider for IE css style
49
- # corrections the usage of conditionals comments in your (X)HTML document.
50
- def remove_comments!
51
- input = @style
52
- @style = ''
53
-
54
- while input.length > 0 do
55
- pos = input.index("/*");
56
-
57
- # No more comments
58
- if pos == nil
59
- @style += input
60
- input = '';
61
- else # Comment beginning at pos
62
- @style += input[0..(pos-1)] if pos > 0 # only append text if there is some
63
- input = input[(pos+2)..-1]
64
- # Comment ending at pos
65
- pos = input.index("*/")
66
- input = input[(pos+2)..-1]
67
- end
68
- end
69
- end
70
-
71
- # Remove all newline characters
72
- #
73
- # We take care of Windows(\r\n), Unix(\n) and Mac(\r) newlines.
74
- def remove_newlines!
75
- @style.gsub! /\n|\r/, ''
76
- end
77
-
78
- # Remove unneeded spaces
79
- #
80
- # 1. Turn mutiple spaces into a single
81
- # 2. Remove spaces around ;:{},
82
- # 3. Remove tabs
83
- def remove_spaces!
84
- @style.gsub! /\s*(\s|;|:|\}|\{|,)\s*/, '\1'
85
- @style.gsub! "\t", ''
86
- end
87
-
88
- # Replace color values with their shorter equivalent
89
- #
90
- # 1. Turn rgb(,,)-colors into #-values
91
- # 2. Shorten #AABBCC down to #ABC
92
- # 3. Replace names with their shorter hex-equivalent
93
- # * white -> #fff
94
- # * black -> #000
95
- # 4. Replace #-values with their shorter name
96
- # * #f00 -> red
97
- def shorten_colors!
98
- # rgb(50,101,152) to #326598
99
- @style.gsub! /rgb\s*\(\s*([0-9,\s]+)\s*\)/ do |match|
100
- out = '#'
101
- $1.split(',').each do |num|
102
- out += '0' if num.to_i < 16
103
- out += num.to_i.to_s(16) # convert to hex
104
- end
105
- out
106
- end
107
- # Convert #AABBCC to #ABC, keep if preceed by a '='
108
- @style.gsub! /([^\"'=\s])(\s*)#([\da-f])\3([\da-f])\4([\da-f])\5/i, '\1#\3\4\5'
109
-
110
- # At the moment we assume that colours only appear before ';' or '}' and
111
- # after a ':', if there could be an occurence of a color before or after
112
- # an other character, submit either a bug report or, better, a patch that
113
- # enables Rainpress to take care of this.
114
-
115
- # shorten several names to numbers
116
- ## shorten white -> #fff
117
- @style.gsub! /:\s*white\s*(;|\})/, ':#fff\1'
118
-
119
- ## shorten black -> #000
120
- @style.gsub! /:\s*black\s*(;|\})/, ':#000\1'
121
-
122
- # shotern several numbers to names
123
- ## shorten #f00 or #ff0000 -> red
124
- @style.gsub! /:\s*#f{1,2}0{2,4}(;|\})/i, ':red\1'
125
- end
126
-
127
- # Do miscellaneous compression methods on the style.
128
- def do_misc!
129
- # Replace 0(pt,px,em,%) with 0 but only when preceded by : or a white-space
130
- @style.gsub! /([\s:]+)(0)(px|em|%|in|cm|mm|pc|pt|ex)/i, '\1\2'
131
-
132
- # Replace :0 0 0 0(;|}) with :0(;|})
133
- @style.gsub! /:0 0 0 0(;|\})/, ':0\1'
134
-
135
- # Replace :0 0 0(;|}) with :0(;|})
136
- @style.gsub! /:0 0 0(;|\})/, ':0\1'
137
-
138
- # Replace :0 0(;|}) with :0(;|})
139
- @style.gsub! /:0 0(;|\})/, ':0\1'
140
-
141
- # Replace background-position:0; with background-position:0 0;
142
- @style.gsub! 'background-position:0;', 'background-position:0 0;'
143
-
144
- # Replace 0.6 to .6, but only when preceded by : or a white-space
145
- @style.gsub! /[:\s]0+\.(\d+)/ do |match|
146
- match.sub '0', '' # only first '0' !!
147
- end
148
-
149
- # Replace multiple ';' with a single ';'
150
- @style.gsub! /[;]+/, ';'
151
-
152
- # Replace ;} with }
153
- @style.gsub! ';}', '}'
154
-
155
- # Replace font-weight:normal; with 400
156
- @style.gsub! /font-weight[\s]*:[\s]*normal[\s]*(;|\})/i,'font-weight:400\1'
157
- @style.gsub! /font[\s]*:[\s]*normal[\s;\}]*/ do |match|
158
- match.sub 'normal', '400'
159
- end
160
-
161
- # Replace font-weight:bold; with 700
162
- @style.gsub! /font-weight[\s]*:[\s]*bold[\s]*(;|\})/,'font-weight:700\1'
163
- @style.gsub! /font[\s]*:[\s]*bold[\s;\}]*/ do |match|
164
- match.sub 'bold', '700'
165
- end
166
- end
167
-
168
- end
@@ -1,2 +0,0 @@
1
- /* Base
2
- ================================================== */
@@ -1,2 +0,0 @@
1
- /* Layout
2
- ================================================== */
@@ -1,2 +0,0 @@
1
- /* States
2
- ================================================== */
@@ -1,2 +0,0 @@
1
- /* Themes
2
- ================================================== */
@@ -1,2 +0,0 @@
1
- /* Buttons
2
- ================================================== */