pure-place-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +27 -0
  5. data/Rakefile +1 -0
  6. data/app/assets/stylesheets/pure-place/.bowerrc +4 -0
  7. data/app/assets/stylesheets/pure-place/.csslintrc +5 -0
  8. data/app/assets/stylesheets/pure-place/.gitignore +6 -0
  9. data/app/assets/stylesheets/pure-place/.travis.yml +6 -0
  10. data/app/assets/stylesheets/pure-place/CONTRIBUTING.md +131 -0
  11. data/app/assets/stylesheets/pure-place/Gruntfile.js +444 -0
  12. data/app/assets/stylesheets/pure-place/HISTORY.md +109 -0
  13. data/app/assets/stylesheets/pure-place/LICENSE.md +52 -0
  14. data/app/assets/stylesheets/pure-place/README.md +120 -0
  15. data/app/assets/stylesheets/pure-place/bower.json +7 -0
  16. data/app/assets/stylesheets/pure-place/build/base-context-min.css +11 -0
  17. data/app/assets/stylesheets/pure-place/build/base-context.css +243 -0
  18. data/app/assets/stylesheets/pure-place/build/base-min.css +11 -0
  19. data/app/assets/stylesheets/pure-place/build/base.css +538 -0
  20. data/app/assets/stylesheets/pure-place/build/buttons-core-min.css +7 -0
  21. data/app/assets/stylesheets/pure-place/build/buttons-core.css +28 -0
  22. data/app/assets/stylesheets/pure-place/build/buttons-min.css +7 -0
  23. data/app/assets/stylesheets/pure-place/build/buttons.css +105 -0
  24. data/app/assets/stylesheets/pure-place/build/forms-core-min.css +11 -0
  25. data/app/assets/stylesheets/pure-place/build/forms-core.css +159 -0
  26. data/app/assets/stylesheets/pure-place/build/forms-min.css +11 -0
  27. data/app/assets/stylesheets/pure-place/build/forms-nr-min.css +11 -0
  28. data/app/assets/stylesheets/pure-place/build/forms-nr.css +404 -0
  29. data/app/assets/stylesheets/pure-place/build/forms.css +467 -0
  30. data/app/assets/stylesheets/pure-place/build/grids-core-min.css +7 -0
  31. data/app/assets/stylesheets/pure-place/build/grids-core.css +31 -0
  32. data/app/assets/stylesheets/pure-place/build/grids-min.css +7 -0
  33. data/app/assets/stylesheets/pure-place/build/grids-nr-min.css +7 -0
  34. data/app/assets/stylesheets/pure-place/build/grids-nr.css +180 -0
  35. data/app/assets/stylesheets/pure-place/build/grids-units-min.css +7 -0
  36. data/app/assets/stylesheets/pure-place/build/grids-units.css +154 -0
  37. data/app/assets/stylesheets/pure-place/build/grids.css +242 -0
  38. data/app/assets/stylesheets/pure-place/build/menus-core-min.css +7 -0
  39. data/app/assets/stylesheets/pure-place/build/menus-core.css +143 -0
  40. data/app/assets/stylesheets/pure-place/build/menus-min.css +7 -0
  41. data/app/assets/stylesheets/pure-place/build/menus-nr-min.css +7 -0
  42. data/app/assets/stylesheets/pure-place/build/menus-nr.css +265 -0
  43. data/app/assets/stylesheets/pure-place/build/menus-paginator-min.css +7 -0
  44. data/app/assets/stylesheets/pure-place/build/menus-paginator.css +40 -0
  45. data/app/assets/stylesheets/pure-place/build/menus.css +276 -0
  46. data/app/assets/stylesheets/pure-place/build/pure-min.css +16 -0
  47. data/app/assets/stylesheets/pure-place/build/pure-nr-min.css +16 -0
  48. data/app/assets/stylesheets/pure-place/build/tables-min.css +11 -0
  49. data/app/assets/stylesheets/pure-place/build/tables.css +84 -0
  50. data/app/assets/stylesheets/pure-place/grunt-pure-place.js +95 -0
  51. data/app/assets/stylesheets/pure-place/package.json +23 -0
  52. data/app/assets/stylesheets/pure-place/scss/_grid-classes.scss +4 -0
  53. data/app/assets/stylesheets/pure-place/scss/_grid-functions.scss +62 -0
  54. data/app/assets/stylesheets/pure-place/scss/_pure-classes-nr.scss +9 -0
  55. data/app/assets/stylesheets/pure-place/scss/_pure-classes.scss +9 -0
  56. data/app/assets/stylesheets/pure-place/scss/_pure-placeholders-nr.scss +8 -0
  57. data/app/assets/stylesheets/pure-place/scss/_pure-placeholders.scss +8 -0
  58. data/app/assets/stylesheets/pure-place/scss/classes/_base.scss +565 -0
  59. data/app/assets/stylesheets/pure-place/scss/classes/_buttons.scss +118 -0
  60. data/app/assets/stylesheets/pure-place/scss/classes/_forms-nr.scss +453 -0
  61. data/app/assets/stylesheets/pure-place/scss/classes/_forms.scss +517 -0
  62. data/app/assets/stylesheets/pure-place/scss/classes/_grids-nr.scss +188 -0
  63. data/app/assets/stylesheets/pure-place/scss/classes/_grids.scss +256 -0
  64. data/app/assets/stylesheets/pure-place/scss/classes/_menus-nr.scss +292 -0
  65. data/app/assets/stylesheets/pure-place/scss/classes/_menus.scss +303 -0
  66. data/app/assets/stylesheets/pure-place/scss/classes/_tables.scss +95 -0
  67. data/app/assets/stylesheets/pure-place/scss/placeholders/_base.scss +423 -0
  68. data/app/assets/stylesheets/pure-place/scss/placeholders/_buttons.scss +113 -0
  69. data/app/assets/stylesheets/pure-place/scss/placeholders/_forms-nr.scss +400 -0
  70. data/app/assets/stylesheets/pure-place/scss/placeholders/_forms.scss +464 -0
  71. data/app/assets/stylesheets/pure-place/scss/placeholders/_grids-nr.scss +180 -0
  72. data/app/assets/stylesheets/pure-place/scss/placeholders/_grids.scss +245 -0
  73. data/app/assets/stylesheets/pure-place/scss/placeholders/_menus-nr.scss +287 -0
  74. data/app/assets/stylesheets/pure-place/scss/placeholders/_menus.scss +298 -0
  75. data/app/assets/stylesheets/pure-place/scss/placeholders/_tables.scss +83 -0
  76. data/app/assets/stylesheets/pure-place/src/base/LICENSE.md +19 -0
  77. data/app/assets/stylesheets/pure-place/src/base/README.md +17 -0
  78. data/app/assets/stylesheets/pure-place/src/base/bower.json +23 -0
  79. data/app/assets/stylesheets/pure-place/src/base/css/normalize-context.css +233 -0
  80. data/app/assets/stylesheets/pure-place/src/base/css/normalize.css +528 -0
  81. data/app/assets/stylesheets/pure-place/src/base/tests/manual/test.html +354 -0
  82. data/app/assets/stylesheets/pure-place/src/buttons/css/buttons-core.css +22 -0
  83. data/app/assets/stylesheets/pure-place/src/buttons/css/buttons.css +76 -0
  84. data/app/assets/stylesheets/pure-place/src/buttons/tests/manual/button.html +112 -0
  85. data/app/assets/stylesheets/pure-place/src/forms/css/forms-core.css +149 -0
  86. data/app/assets/stylesheets/pure-place/src/forms/css/forms-r.css +62 -0
  87. data/app/assets/stylesheets/pure-place/src/forms/css/forms.css +244 -0
  88. data/app/assets/stylesheets/pure-place/src/forms/tests/manual/forms.html +324 -0
  89. data/app/assets/stylesheets/pure-place/src/grids/css/grids-core.css +25 -0
  90. data/app/assets/stylesheets/pure-place/src/grids/css/grids-r.css +61 -0
  91. data/app/assets/stylesheets/pure-place/src/grids/css/grids-units.css +148 -0
  92. data/app/assets/stylesheets/pure-place/src/grids/tests/manual/responsive.html +174 -0
  93. data/app/assets/stylesheets/pure-place/src/menus/css/menus-core.css +137 -0
  94. data/app/assets/stylesheets/pure-place/src/menus/css/menus-paginator.css +34 -0
  95. data/app/assets/stylesheets/pure-place/src/menus/css/menus-r.css +10 -0
  96. data/app/assets/stylesheets/pure-place/src/menus/css/menus.css +86 -0
  97. data/app/assets/stylesheets/pure-place/src/menus/tests/manual/menus.html +191 -0
  98. data/app/assets/stylesheets/pure-place/src/tables/css/tables.css +74 -0
  99. data/app/assets/stylesheets/pure-place/src/tables/tests/manual/tables.html +251 -0
  100. data/lib/pure-place.rb +16 -0
  101. data/lib/pure-place/engine.rb +5 -0
  102. data/lib/pure-place/version.rb +3 -0
  103. data/pure-place-rails.gemspec +24 -0
  104. metadata +161 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f12dde44df75d881871b2427a2cce621f3051d05
4
+ data.tar.gz: b05a8801673c39679a7c5dc9b522fdd5ba13b743
5
+ SHA512:
6
+ metadata.gz: 9f342f517df8ef4d56949f75c845f71fd716e59d94b1882391a903a32a29cde173f8dccf26c6b6a83b16467d355f720815de4e223d1eaf0cb0a35ae2d9e9910f
7
+ data.tar.gz: 8aa22938809877616c559936e025533823e453fab5e98e7488330e6810743da5bc2223dc3affdf319ffed327b14067536fa24638f87ececb3e84dc572bb5a1cf
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pure-place-rails.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Matthew Lehner
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,27 @@
1
+ # Pure-Place for the Rails Asset Pipeline
2
+
3
+ Wrapped up the wonderful (Pure-Place)[https://github.com/jjt/pure-place] work and made a gem for the asset pipeline.
4
+
5
+ ## Installation for Rails 3.1+
6
+
7
+ In your Gemfile:
8
+
9
+ gem 'pure-place-rails', github: 'matthewlehner/pure-place-rails'
10
+
11
+ And then run:
12
+
13
+ $ bundle install
14
+
15
+ Restart your server. Then rename application`.css` to application`.css.scss`:
16
+
17
+ mv app/assets/stylesheeets/application.css app/assets/stylesheets/application.css.scss
18
+
19
+ Delete the sprocket directive in application.css.scss: [Why?](https://github.com/thoughtbot/bourbon/wiki/Rails-Sprockets)
20
+
21
+ *= require_tree .
22
+
23
+ Import Pure-Place at the beginning of application.css.scss. All additional stylesheets must be imported below Pure-Place:
24
+
25
+ @import "pure-place";
26
+ @import "home";
27
+ @import "users";
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ {
2
+ "directory": "bower_components",
3
+ "json" : "bower.json"
4
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "box-sizing" : false,
3
+ "display-property-grouping": false,
4
+ "star-property-hack" : false
5
+ }
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ artifacts/
3
+ bower_components/
4
+ coverage/
5
+ node_modules/
6
+ release/
@@ -0,0 +1,6 @@
1
+ language: node_js
2
+ node_js:
3
+ - "0.10"
4
+ before_script:
5
+ - npm install -g grunt-cli
6
+ script: grunt test
@@ -0,0 +1,131 @@
1
+ How to Contribute to Pure
2
+ =========================
3
+
4
+ Feel free to [open issues][] and send pull requests on GitHub! When sending a
5
+ pull request, please create a new topic/feature branch, and send your pull
6
+ request from that branch. Please do *not* send pull requests from your `master`
7
+ branch because this tends to lead to merge conflicts.
8
+
9
+ In order for us to to merge your pull requests, we need you to review and sign
10
+ our [Contributor License Agreement][]. The CLA protects you and your
11
+ contributions along with all other developers who use Pure.
12
+
13
+
14
+ [Contributor License Agreement]: #contributor-license-agreement
15
+ [open issues]: https://github.com/yui/pure/issues
16
+
17
+
18
+ Docs and Website
19
+ ----------------
20
+
21
+ [Pure's website][Pure] is also open source, so please open any issues or pull
22
+ requests for the docs and website over at the [`pure-site`][pure-site]
23
+ repository.
24
+
25
+
26
+ [Pure]: http://purecss.io/
27
+ [pure-site]: https://github.com/yui/pure-site
28
+
29
+
30
+ Building and Testing Pure
31
+ -------------------------
32
+
33
+ Pure uses [Grunt][], a JavaScript task runner that runs on [Node.js][], for
34
+ building and testing. You'll need Node.js and Grunt installed to work on Pure.
35
+ Once installed, clone the `pure` repo (either the main repo or your fork) and
36
+ install Pure's gruntplugins via npm:
37
+
38
+ ```shell
39
+ $ git clone git://github.com/yui/pure.git
40
+ $ cd pure/
41
+ $ npm install
42
+ ```
43
+
44
+ Building Pure is easy, run `grunt`:
45
+
46
+ ```shell
47
+ $ grunt
48
+ ```
49
+
50
+ Pure use [CSSLint][] for basic testing to make sure we're shipping valid CSS
51
+ which complies with standard best practices. To run Pure's tests, run
52
+ `grunt test`:
53
+
54
+ ```shell
55
+ $ grunt test
56
+ ```
57
+
58
+ **Note:** To save your fingers from The Developer Konami Code: ⌘⇥ ↑ ⏎ run the
59
+ `grunt watch` task with will continuously test and build Pure anytime a CSS file
60
+ changes:
61
+
62
+ ```shell
63
+ $ grunt watch
64
+ ```
65
+
66
+ ### Browser Support and Testing
67
+
68
+ Pure is tested and works in:
69
+
70
+ * IE 7+
71
+ * Latest Stable: Firefox, Chrome, Safari
72
+ * iOS 6.x
73
+ * Android 4.x
74
+
75
+ Before sending pull requests, please ensure that you open the test HTML files
76
+ in these environments. If you don't have access to all these environments, list
77
+ the ones that you have tested in on the pull request description. That way, we
78
+ know what's missing, and can help you out.
79
+
80
+
81
+ [Grunt]: http://gruntjs.com/
82
+ [Node.js]: http://nodejs.org/
83
+ [CSSLint]: https://github.com/stubbornella/csslint
84
+
85
+
86
+ Coding Standards and Style Guide
87
+ --------------------------------
88
+
89
+ Pure has adopted the [SMACSS][] conventions for writing CSS. If you are new to
90
+ SMACSS, you should give it a read, especially the section on [module rules][].
91
+
92
+ The [Extend][] section of the Pure website more info about the style guide and
93
+ naming conventions, along with examples of how to extend the library.
94
+
95
+
96
+ [SMACSS]: http://smacss.com/
97
+ [module rules]: http://smacss.com/book/type-module
98
+ [Extend]: http://purecss.io/extend/
99
+
100
+
101
+ Contributor License Agreement
102
+ -----------------------------
103
+
104
+ Please [sign Pure's CLA][CLA] before sending pull requests. We can't merge your
105
+ pull requests unless you have a signed CLA.
106
+
107
+ The CLA ensures that everyone who submits a work of authorship to Pure is
108
+ contributing work that is their own or for which they can authoritatively speak.
109
+ This protects the all of of developers who use Pure in their daily work, all of
110
+ whom rely on Pure's BSD license to appropriately cover their use of the library.
111
+
112
+ The CLA does **not** transfer title or copyright of your contributed work to
113
+ Yahoo!. It merely guarantees that you approve the use of your work within Pure
114
+ and by those who use the library under the terms of its license.
115
+
116
+ If you want to make contributions (software, documentation or other material) to
117
+ the Pure Project and such contributions could be covered under intellectual
118
+ property laws, you must submit a Contributor License Agreement (CLA) prior to
119
+ making your contribution:
120
+
121
+ 1. Review Pure's BSD license. All of Pure's code is issued under this license,
122
+ and contributions you make to the library will be subject to this license.
123
+ **Note:** that the BSD license is very liberal; it allows for reuse and
124
+ adaptation in commercial projects.
125
+
126
+ 2. [Sign the Pure CLA online][CLA]. You will receive confirmation of your CLA
127
+ submission via the email address provided on the CLA form. If you have
128
+ questions about the CLA, you can address them to yui-cla@yahoo-inc.com.
129
+
130
+
131
+ [CLA]: https://secure.echosign.com/public/hostedForm?formid=A9PFU5T58653A
@@ -0,0 +1,444 @@
1
+ var path = require('path');
2
+
3
+ module.exports = function (grunt) {
4
+
5
+
6
+ // -- Config -------------------------------------------------------------------
7
+
8
+ grunt.initConfig({
9
+
10
+ pkg : grunt.file.readJSON('package.json'),
11
+ normalize: grunt.file.readJSON('src/base/bower.json'),
12
+
13
+ // -- Constants ------------------------------------------------------------
14
+
15
+ BUILD_COMMENT: 'THIS FILE IS GENERATED BY A BUILD SCRIPT - DO NOT EDIT!',
16
+
17
+ // -- Clean Config ---------------------------------------------------------
18
+
19
+ clean: {
20
+ build : ['build/'],
21
+ build_res: ['build/*-r.css'],
22
+ release : ['release/<%= pkg.version %>/'],
23
+ base : ['src/base/css/', 'src/base/bower.json', 'src/base/LICENSE.md']
24
+ },
25
+
26
+ // -- Copy Config ----------------------------------------------------------
27
+
28
+ copy: {
29
+ build: {
30
+ expand : true,
31
+ flatten: true,
32
+ src : 'src/**/css/*.css',
33
+ dest : 'build/',
34
+
35
+ rename: function (dest, src) {
36
+ // normalize -> base
37
+ src = src.replace(/^normalize(-.+\.css|\.css)$/, 'base$1');
38
+ return path.join(dest, src);
39
+ }
40
+ },
41
+
42
+ normalize: {
43
+ expand : true,
44
+ flatten: true,
45
+ cwd : 'bower_components/normalize-css/',
46
+ src : '{bower.json,LICENSE.md,normalize.css}',
47
+ dest : 'src/base/',
48
+
49
+ rename: function (dest, file) {
50
+ if (grunt.file.isMatch('*.css', file)) {
51
+ return path.join(dest, 'css', file);
52
+ }
53
+
54
+ return path.join(dest, file);
55
+ },
56
+
57
+ options: {
58
+ processContent: function (content, file) {
59
+ var comment = grunt.config('BUILD_COMMENT');
60
+
61
+ if (grunt.file.isMatch({matchBase: true}, '*.css', file)) {
62
+ content = '/* ' + comment + ' */\n' + content;
63
+ } else if (grunt.file.isMatch({matchBase: true}, '*.html', file)) {
64
+ content = '<!-- ' + comment + ' -->\n' + content;
65
+ }
66
+
67
+ return content;
68
+ }
69
+ }
70
+ }
71
+ },
72
+
73
+ // -- Concat Config --------------------------------------------------------
74
+
75
+ concat: {
76
+ build: {
77
+ files: [
78
+ {'build/buttons.css': [
79
+ 'build/buttons-core.css',
80
+ 'build/buttons.css'
81
+ ]},
82
+
83
+ {'build/forms-nr.css': [
84
+ 'build/forms-core.css',
85
+ 'build/forms.css'
86
+ ]},
87
+
88
+ {'build/forms.css': [
89
+ 'build/forms-nr.css',
90
+ 'build/forms-r.css'
91
+ ]},
92
+
93
+ {'build/grids-nr.css': [
94
+ 'build/grids-core.css',
95
+ 'build/grids-units.css'
96
+ ]},
97
+
98
+ {'build/grids.css': [
99
+ 'build/grids-nr.css',
100
+ 'build/grids-r.css'
101
+ ]},
102
+
103
+ {'build/menus-nr.css': [
104
+ 'build/menus-core.css',
105
+ 'build/menus.css',
106
+ 'build/menus-paginator.css'
107
+ ]},
108
+
109
+ {'build/menus.css': [
110
+ 'build/menus-nr.css',
111
+ 'build/menus-r.css'
112
+ ]}
113
+ ]
114
+ },
115
+
116
+ all: {
117
+ files: {
118
+ 'build/<%= pkg.name %>-min.css': [
119
+ 'build/base-min.css',
120
+ 'build/buttons-min.css',
121
+ 'build/forms-min.css',
122
+ 'build/grids-min.css',
123
+ 'build/menus-min.css',
124
+ 'build/tables-min.css'
125
+ ],
126
+
127
+ 'build/<%= pkg.name %>-nr-min.css': [
128
+ 'build/base-min.css',
129
+ 'build/buttons-min.css',
130
+ 'build/forms-nr-min.css',
131
+ 'build/grids-nr-min.css',
132
+ 'build/menus-nr-min.css',
133
+ 'build/tables-min.css'
134
+ ]
135
+ }
136
+ }
137
+ },
138
+
139
+ // -- CSSLint Config -------------------------------------------------------
140
+
141
+ csslint: {
142
+ options: {
143
+ csslintrc: '.csslintrc'
144
+ },
145
+
146
+ src: {
147
+ src: [
148
+ 'src/**/css/*.css',
149
+ '!src/base/css/*',
150
+ '!src/forms/css/forms-core.css'
151
+ ]
152
+ }
153
+ },
154
+
155
+ // -- CSSMin Config --------------------------------------------------------
156
+
157
+ cssmin: {
158
+ options: {
159
+ // report: 'gzip'
160
+ },
161
+
162
+ files: {
163
+ expand: true,
164
+ src : 'build/*.css',
165
+ ext : '-min.css'
166
+ }
167
+ },
168
+
169
+ // -- Compress Config ------------------------------------------------------
170
+
171
+ compress: {
172
+ release: {
173
+ options: {
174
+ archive: 'release/<%= pkg.version %>/<%= pkg.name %>-<%= pkg.version %>.zip'
175
+ },
176
+
177
+ expand : true,
178
+ flatten: true,
179
+ src : 'build/*.css',
180
+ dest : '<%= pkg.name %>/<%= pkg.version %>/'
181
+ }
182
+ },
183
+
184
+ // -- License Config -------------------------------------------------------
185
+
186
+ license: {
187
+ normalize: {
188
+ options: {
189
+ banner: [
190
+ '/*!',
191
+ 'normalize.css v<%= normalize.version %> | MIT License | git.io/normalize',
192
+ 'Copyright (c) Nicolas Gallagher and Jonathan Neal',
193
+ '*/\n'
194
+ ].join('\n')
195
+ },
196
+
197
+ expand: true,
198
+ cwd : 'build/',
199
+ src : ['base*.css', 'forms*.css', 'tables*.css', '<%= pkg.name %>*.css']
200
+ },
201
+
202
+ yahoo: {
203
+ options: {
204
+ banner: [
205
+ '/*!',
206
+ 'Pure v<%= pkg.version %>',
207
+ 'Copyright 2013 Yahoo! Inc. All rights reserved.',
208
+ 'Licensed under the BSD License.',
209
+ 'https://github.com/yui/pure/blob/master/LICENSE.md',
210
+ '*/\n'
211
+ ].join('\n')
212
+ },
213
+
214
+ expand: true,
215
+ src : ['build/*.css']
216
+ }
217
+ },
218
+
219
+ // -- Contextualize Config -------------------------------------------------
220
+
221
+ contextualize: {
222
+ normalize: {
223
+ src : 'src/base/css/normalize.css',
224
+ dest: 'src/base/css/normalize-context.css',
225
+
226
+ options: {
227
+ prefix: '.pure',
228
+ banner: '/* <%= BUILD_COMMENT %> */\n'
229
+ }
230
+ }
231
+ },
232
+
233
+ // -- Watch/Observe Config -------------------------------------------------
234
+
235
+ observe: {
236
+ src: {
237
+ files: 'src/**/css/*.css',
238
+ tasks: ['test', 'suppress', 'default'],
239
+
240
+ options: {
241
+ interrupt: true
242
+ }
243
+ }
244
+ }
245
+
246
+ });
247
+
248
+ //console.log(grunt.config);
249
+
250
+ // -- Main Tasks ---------------------------------------------------------------
251
+
252
+ grunt.loadNpmTasks('grunt-contrib-clean');
253
+ grunt.loadNpmTasks('grunt-contrib-copy');
254
+ grunt.loadNpmTasks('grunt-contrib-concat');
255
+ grunt.loadNpmTasks('grunt-contrib-csslint');
256
+ grunt.loadNpmTasks('grunt-contrib-cssmin');
257
+ grunt.loadNpmTasks('grunt-contrib-compress');
258
+ grunt.loadNpmTasks('grunt-contrib-watch');
259
+
260
+ grunt.registerTask('default', [
261
+ 'clean:build',
262
+ 'copy:build',
263
+ 'concat:build',
264
+ 'clean:build_res',
265
+ 'cssmin',
266
+ 'concat:all',
267
+ 'license'
268
+ ]);
269
+
270
+ grunt.registerTask('test', [
271
+ 'csslint'
272
+ ]);
273
+
274
+ // Makes the `watch` task run a build first.
275
+ grunt.renameTask('watch', 'observe');
276
+ grunt.registerTask('watch', ['default', 'observe']);
277
+
278
+ grunt.registerTask('import', [
279
+ 'bower-install',
280
+ 'import-normalize'
281
+ ]);
282
+
283
+ grunt.registerTask('release', [
284
+ 'test',
285
+ 'default',
286
+ 'clean:release',
287
+ 'compress:release'
288
+ ]);
289
+
290
+
291
+ // -- Pure Place Config/Task ----------------------------------------------------
292
+
293
+ grunt.config.set('pure-place-src', {
294
+ files: 'src/**/css/*.css',
295
+ options: {
296
+ dest: 'scss'
297
+ }
298
+ });
299
+
300
+ grunt.config.set('pure-place-build', {
301
+ files: 'build/*.css',
302
+ options: {
303
+ dest: 'scss'
304
+ }
305
+ });
306
+
307
+ grunt.loadNpmTasks('grunt-pure-place');
308
+
309
+
310
+ // -- Suppress Task ------------------------------------------------------------
311
+
312
+ grunt.registerTask('suppress', function () {
313
+ var allowed = ['success', 'fail', 'warn', 'error'];
314
+
315
+ grunt.util.hooker.hook(grunt.log, {
316
+ passName: true,
317
+
318
+ pre: function (name) {
319
+ if (allowed.indexOf(name) === -1) {
320
+ grunt.log.muted = true;
321
+ }
322
+ },
323
+
324
+ post: function () {
325
+ grunt.log.muted = false;
326
+ }
327
+ });
328
+ });
329
+
330
+ // -- Import Tasks -------------------------------------------------------------
331
+
332
+ grunt.registerTask('import-normalize', [
333
+ 'clean:base',
334
+ 'copy:normalize',
335
+ 'contextualize:normalize'
336
+ ]);
337
+
338
+ // -- Bower Task ---------------------------------------------------------------
339
+
340
+ grunt.registerTask('bower-install', 'Installs Bower dependencies.', function () {
341
+ var bower = require('bower'),
342
+ done = this.async();
343
+
344
+ bower.commands.install()
345
+ .on('data', function (data) { grunt.log.write(data); })
346
+ .on('end', done);
347
+ });
348
+
349
+ // -- License Task -------------------------------------------------------------
350
+
351
+ grunt.registerMultiTask('license', 'Stamps license banners on files.', function () {
352
+ var options = this.options({banner: ''}),
353
+ banner = grunt.template.process(options.banner),
354
+ tally = 0;
355
+
356
+ this.files.forEach(function (filePair) {
357
+ filePair.src.forEach(function (file) {
358
+ grunt.file.write(file, banner + grunt.file.read(file));
359
+ tally += 1;
360
+ });
361
+ });
362
+
363
+ grunt.log.writeln('Stamped license on ' + String(tally).cyan + ' files.');
364
+ });
365
+
366
+ // -- Contextualize Task -------------------------------------------------------
367
+
368
+ grunt.registerMultiTask('contextualize', 'Makes Contextualized CSS files.', function () {
369
+ var Parser = require('parserlib').css.Parser,
370
+ done = this.async(),
371
+ options = this.options({banner: ''}),
372
+ banner = grunt.template.process(options.banner),
373
+ processing = 0;
374
+
375
+ function oneDone() {
376
+ if (!(processing -= 1)) {
377
+ done();
378
+ }
379
+ }
380
+
381
+ this.files.forEach(function (filePair) {
382
+ filePair.src.forEach(function (file) {
383
+ var src = grunt.file.read(file),
384
+ contextual = banner,
385
+ parser = new Parser();
386
+
387
+ parser.addListener('endstylesheet', function () {
388
+ grunt.file.write(filePair.dest, contextual);
389
+ grunt.log.writeln('File "' + filePair.dest + '" created.');
390
+ oneDone();
391
+ });
392
+
393
+ // Fired right before CSS properties are parsed for a certain rule.
394
+ // Go through and add all the selectors to the `css` string.
395
+ parser.addListener('startrule', function (event) {
396
+ var prefix = options.prefix;
397
+
398
+ event.selectors.forEach(function (selector, i) {
399
+ var nextSelector = event.selectors[i + 1];
400
+
401
+ // If the selector does not contain the html selector, we
402
+ // can go ahead and prepend `prefix` in front of it.
403
+ if (selector.text.indexOf('html') === -1) {
404
+ contextual += prefix + ' ' + selector.text;
405
+ } else if (selector.text.indexOf('html') !== -1) {
406
+ // If it contains `html`, replace the `html` with the
407
+ // `prefix`. Replace multiple spaces with a single
408
+ // space. This is for the case where
409
+ // `html input[type='button']` comes through as
410
+ // `html input[type='button']`.
411
+ contextual += selector.text.replace('html', prefix).replace(/ +/g, ' ');
412
+ }
413
+
414
+ // If theres another selector, add a comma.
415
+ if (nextSelector) {
416
+ contextual += ',\n';
417
+ } else {
418
+ // Otherwise, add an opening bracket for properties
419
+ contextual += ' {\n';
420
+ }
421
+ });
422
+ });
423
+
424
+ // Fired right after CSS properties are parsed for a certain rule.
425
+ // Add the closing bracket to end the CSS Rule.
426
+ parser.addListener('endrule', function (event) {
427
+ contextual += '}\n';
428
+ });
429
+
430
+ // Fired for each property that the parser encounters. Add these
431
+ // properties to the `css` string with 4 spaces.
432
+ parser.addListener('property', function (event) {
433
+ // Add 4 spaces tab.
434
+ contextual += ' ' + event.property + ': ' + event.value + ';\n';
435
+ });
436
+
437
+ // Do the parsing.
438
+ processing += 1;
439
+ parser.parse(src);
440
+ });
441
+ });
442
+ });
443
+
444
+ };