1 | #!/usr/bin/env ruby |
---|
2 | require File.join(File.dirname(__FILE__), "blueprint", "blueprint") |
---|
3 | |
---|
4 | # **Basic |
---|
5 | # |
---|
6 | # Calling this file by itself will pull files from blueprint/src and |
---|
7 | # concatenate them into three files; ie.css, print.css, and screen.css. |
---|
8 | # |
---|
9 | # ruby compress.rb |
---|
10 | # |
---|
11 | # However, argument variables can be set to change how this works. |
---|
12 | # |
---|
13 | # Calling |
---|
14 | # |
---|
15 | # ruby compress.rb -h |
---|
16 | # |
---|
17 | # will reveal basic arguments you can pass to the compress.rb file. |
---|
18 | # |
---|
19 | # **Custom Settings |
---|
20 | # |
---|
21 | # To use custom settings, the file need to be stored in settings.yml within |
---|
22 | # this directory. An example YAML file has been included. |
---|
23 | # |
---|
24 | # Another ability is to use YAML (spec is at http://www.yaml.org/spec/1.1/) |
---|
25 | # for project settings in a predefined structure and store all pertinent |
---|
26 | # information there. The YAML file has multiple keys (usually a named |
---|
27 | # project) with a set of data that defines that project. A sample structure |
---|
28 | # can be found in settings.example.yml. |
---|
29 | # |
---|
30 | # The basic structure is this: |
---|
31 | # |
---|
32 | # Root nodes are project names. You use these when calling compress.rb as such: |
---|
33 | # |
---|
34 | # ruby compress.rb -p PROJECTNAME |
---|
35 | # |
---|
36 | # A sample YAML with only roots and output paths would look like this: |
---|
37 | # |
---|
38 | # project1: |
---|
39 | # path: /path/to/my/project/stylesheets |
---|
40 | # project2: |
---|
41 | # path: /path/to/different/stylesheets |
---|
42 | # project3: |
---|
43 | # path: /path/to/another/projects/styles |
---|
44 | # |
---|
45 | # You can then call |
---|
46 | # |
---|
47 | # ruby compress.rb -p project1 |
---|
48 | # |
---|
49 | # or |
---|
50 | # |
---|
51 | # ruby compress.rb -p project3 |
---|
52 | # |
---|
53 | # This would compress and export Blueprints CSS to the respective directory, |
---|
54 | # checking for my-(ie|print|screen).css and appending it if present |
---|
55 | # |
---|
56 | # A more advanced structure would look like this: |
---|
57 | # |
---|
58 | # project1: |
---|
59 | # path: /path/to/my/project/stylesheets |
---|
60 | # namespace: custom-namespace-1- |
---|
61 | # custom_css: |
---|
62 | # ie.css: |
---|
63 | # - custom-ie.css |
---|
64 | # print.css: |
---|
65 | # - docs.css |
---|
66 | # - my-print-styles.css |
---|
67 | # screen.css: |
---|
68 | # - subfolder-of-stylesheets/sub_css.css |
---|
69 | # custom_layout: |
---|
70 | # column_count: 12 |
---|
71 | # column_width: 70 |
---|
72 | # gutter_width: 10 |
---|
73 | # project2: |
---|
74 | # path: /path/to/different/stylesheets |
---|
75 | # namespace: different-namespace- |
---|
76 | # custom_css: |
---|
77 | # screen.css: |
---|
78 | # - custom_screen.css |
---|
79 | # semantic_classes: |
---|
80 | # "#footer, #header": column span-24 last |
---|
81 | # "#content": column span-18 border |
---|
82 | # "#extra-content": last span-6 column |
---|
83 | # "div#navigation": last span-24 column |
---|
84 | # "div.section, div.entry, .feeds": span-6 column |
---|
85 | # plugins: |
---|
86 | # - fancy-type |
---|
87 | # - buttons |
---|
88 | # - validations |
---|
89 | # project3: |
---|
90 | # path: /path/to/another/projects/styles |
---|
91 | # |
---|
92 | # In a structure like this, a lot more assignment is occurring. Custom |
---|
93 | # namespaces are being set for two projects, while the third (project3) |
---|
94 | # is just a simple path setting. |
---|
95 | # |
---|
96 | # Also, custom CSS is being used that is appended at the end of its respective |
---|
97 | # file. So, in project1, print.css will have docs.css and my-print-styles.css |
---|
98 | # instead of the default my-print.css. Note that these files are relative |
---|
99 | # to the path that you defined above; you can use subdirectories from the |
---|
100 | # default path if you would like. |
---|
101 | # |
---|
102 | # Another thing to note here is the custom_layout; if not defined, your |
---|
103 | # generated CSS will default to the 24 column, 950px wide grid that has been |
---|
104 | # standard with Blueprint for quite some time. However, you can specify a |
---|
105 | # custom grid setup if you would like. The three options are column_count |
---|
106 | # (the number of columns you want your grid to have), column width (the |
---|
107 | # width in pixels that you want your columns to be), and gutter_width (the |
---|
108 | # width in pixels you want your gutters - space between columns - to be). |
---|
109 | # To use the Blueprint default, do not define this in your settings file. |
---|
110 | # |
---|
111 | # Semantic classes are still in the works within Blueprint, but a simple |
---|
112 | # implementation has been created. |
---|
113 | # |
---|
114 | # Defining semantic_classes, with nodes underneath, will generate a class |
---|
115 | # for each node which has rules of each class assigned to it. For example, |
---|
116 | # in project2 above, for '#footer, #header', elements with id's of footer |
---|
117 | # and header will be assigned all the rules from the classes 'span-24, |
---|
118 | # column, and last', while divs with classes either entry or section, as |
---|
119 | # well as any element with class of feed, is assigned all the rules from |
---|
120 | # 'span-6 and column'. Although it is a crude way do accomplish this, it |
---|
121 | # keeps the generated CSS separate from the core BP CSS. |
---|
122 | # |
---|
123 | # Also supported is plugins. The compressor looks withinBLUEPRINT_DIR/blueprint/plugins |
---|
124 | # to match against what's passed. If the plugin name matches, it will append |
---|
125 | # PLUGIN/(screen|print|ie).css to the corresponding CSS file. It will append |
---|
126 | # the plugin CSS to all three CSS files if there is a CSS file present named |
---|
127 | # as the plugin (e.g. the fancy-type plugin with a fancy-type.css file found |
---|
128 | # within the plugin directory) |
---|
129 | # |
---|
130 | # In Ruby, the structure would look like this: |
---|
131 | # |
---|
132 | # { |
---|
133 | # 'project1' => { |
---|
134 | # 'path' => '/path/to/my/project/stylesheets', |
---|
135 | # 'namespace' => 'custom-namespace-1-', |
---|
136 | # 'custom_css' => { |
---|
137 | # 'ie.css' => ['custom-ie.css'], |
---|
138 | # 'print.css' => ['docs.css', 'my-print-styles.css'], |
---|
139 | # 'screen.css' => ['subfolder-of-stylesheets/sub_css.css'] |
---|
140 | # }, |
---|
141 | # 'custom_layout' => { |
---|
142 | # 'column_count' => 12, |
---|
143 | # 'column_width' => 70, |
---|
144 | # 'gutter_width' => 10 |
---|
145 | # } |
---|
146 | # }, |
---|
147 | # 'project2' => { |
---|
148 | # 'path' => '/path/to/different/stylesheets', |
---|
149 | # 'namespace' => 'different-namespace-', |
---|
150 | # 'custom_css' => { |
---|
151 | # 'screen.css' => ['custom_screen.css'] |
---|
152 | # }, |
---|
153 | # 'semantic_classes' => { |
---|
154 | # '#footer, #header' => 'column span-24 last', |
---|
155 | # '#content' => 'column span-18 border', |
---|
156 | # '#extra-content' => 'last span-6 column', |
---|
157 | # 'div#navigation' => 'last span-24 column', |
---|
158 | # 'div.section, div.entry, .feeds' => 'span-6 column' |
---|
159 | # }, |
---|
160 | # 'plugins' => ['fancy-type', 'buttons', 'validations'] |
---|
161 | # }, |
---|
162 | # 'project3' => { |
---|
163 | # 'path' => '/path/to/another/projects/styles' |
---|
164 | # } |
---|
165 | # } |
---|
166 | |
---|
167 | Blueprint::Compressor.new.generate! |
---|