|
10 | 10 |
|
11 | 11 | ## Installation
|
12 | 12 |
|
13 |
| -GSS will go parallel with [Web Workers](http://www.html5rocks.com/en/tutorials/workers/basics/) when the browser supports it. Thus, you need two JS files to get started; `gss.js` & it's helpful `worker.js`. Use the `GSS_CONFIG` object to set worker URL. |
14 |
| - |
15 | 13 | If you download via Bower:
|
16 | 14 |
|
17 | 15 | {% highlight javascript %}
|
|
21 | 19 | Use the following:
|
22 | 20 |
|
23 | 21 | {% highlight html %}
|
24 |
| -<script> |
25 |
| - GSS_CONFIG = { |
26 |
| - worker: "../bower_components/gss/dist/worker.js" |
27 |
| - } |
| 22 | +<script src="/bower_components/gss/dist/gss.js"></script> |
| 23 | +<script type="text/javascript"> |
| 24 | + window.engine = new GSS(document); |
28 | 25 | </script>
|
29 |
| -<script src="../bower_components/gss/dist/gss.js"></script> |
30 | 26 | {% endhighlight %}
|
31 | 27 |
|
32 | 28 | Otherwise, [download version {{site.version}}](https://github.com/gss/engine/archive/{{ site.version }}.zip) or clone the [github repo](https://github.com/gss/engine).
|
33 | 29 |
|
34 |
| -**IMPORTANT** worker URL must be configured! |
35 |
| - |
36 | 30 | ## Usage
|
37 | 31 |
|
38 | 32 | To load your `.gss` stylesheets, just add `type=text/gss`:
|
|
50 | 44 |
|
51 | 45 | </style>
|
52 | 46 | {% endhighlight %}
|
53 |
| - |
54 |
| - |
55 |
| -## Configuration |
56 |
| - |
57 |
| -Options can be given on the following global object before the `<script src="gss.js"></script>`: |
58 |
| - |
59 |
| -{% highlight html %} |
60 |
| -<script> |
61 |
| -GSS_CONFIG = { |
62 |
| - |
63 |
| - // Web Worker |
64 |
| - // URL to worker must be set! |
65 |
| - worker: '../dist/worker.js', |
66 |
| - useWorker: !!window.Worker, |
67 |
| - |
68 |
| - // Cassowary defaults |
69 |
| - defaultStrength: 'weak', // 'weak', 'medium', 'strong', 'required' |
70 |
| - defaultWeight: 0, |
71 |
| - |
72 |
| - // FOUC prevention |
73 |
| - // adds "gss-ready" and removes "gss-not-ready" classes on html tag |
74 |
| - readyClass: true, |
75 |
| - |
76 |
| - // Fractional pixels values |
77 |
| - // bad for text, good for accuracy |
78 |
| - fractionalPixels: true, |
79 |
| - |
80 |
| - // Scrollbar size offset |
81 |
| - verticalScroll: true, |
82 |
| - horizontalScroll: false, |
83 |
| - |
84 |
| - // Mutation Observer |
85 |
| - observe: true, |
86 |
| - observerOptions: { |
87 |
| - subtree: true, |
88 |
| - childList: true, |
89 |
| - attributes: true, |
90 |
| - characterData: true |
91 |
| - }, |
92 |
| - |
93 |
| - // Callback to process variables before setting DOM |
94 |
| - processBeforeSet: null, // function |
95 |
| - |
96 |
| - // ::window resize debounce time |
97 |
| - resizeDebounce: 32, // (ms) |
98 |
| - |
99 |
| - // Logging |
100 |
| - debug: false, |
101 |
| - warn: false, |
102 |
| - perf: false |
103 |
| - |
104 |
| -}; |
105 |
| -</script> |
106 |
| -<script src="gss.js"></script> |
107 |
| -{% endhighlight %} |
108 |
| - |
109 |
| - |
110 |
| - |
111 |
| - |
0 commit comments