trivial 0.0.5 → 0.0.6

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 (43) hide show
  1. data/CHANGELOG +1 -0
  2. data/Manifest +34 -1
  3. data/Rakefile +16 -1
  4. data/bin/trivialize +80 -17
  5. data/config/trivial.inc +3 -0
  6. data/content/dynamic.inc +1 -0
  7. data/lib/trivial.php +147 -21
  8. data/readme.md +77 -3
  9. data/styles/application.css +0 -7
  10. data/styles/blueprint/LICENSE +314 -0
  11. data/styles/blueprint/ie.css +35 -0
  12. data/styles/blueprint/plugins/buttons/icons/cross.png +0 -0
  13. data/styles/blueprint/plugins/buttons/icons/key.png +0 -0
  14. data/styles/blueprint/plugins/buttons/icons/tick.png +0 -0
  15. data/styles/blueprint/plugins/buttons/readme.txt +32 -0
  16. data/styles/blueprint/plugins/buttons/screen.css +97 -0
  17. data/styles/blueprint/plugins/fancy-type/readme.txt +14 -0
  18. data/styles/blueprint/plugins/fancy-type/screen.css +71 -0
  19. data/styles/blueprint/plugins/link-icons/icons/doc.png +0 -0
  20. data/styles/blueprint/plugins/link-icons/icons/email.png +0 -0
  21. data/styles/blueprint/plugins/link-icons/icons/external.png +0 -0
  22. data/styles/blueprint/plugins/link-icons/icons/feed.png +0 -0
  23. data/styles/blueprint/plugins/link-icons/icons/im.png +0 -0
  24. data/styles/blueprint/plugins/link-icons/icons/pdf.png +0 -0
  25. data/styles/blueprint/plugins/link-icons/icons/visited.png +0 -0
  26. data/styles/blueprint/plugins/link-icons/icons/xls.png +0 -0
  27. data/styles/blueprint/plugins/link-icons/readme.txt +18 -0
  28. data/styles/blueprint/plugins/link-icons/screen.css +40 -0
  29. data/styles/blueprint/plugins/rtl/readme.txt +10 -0
  30. data/styles/blueprint/plugins/rtl/screen.css +110 -0
  31. data/styles/blueprint/print.css +29 -0
  32. data/styles/blueprint/screen.css +258 -0
  33. data/styles/blueprint/src/forms.css +65 -0
  34. data/styles/blueprint/src/grid.css +280 -0
  35. data/styles/blueprint/src/grid.png +0 -0
  36. data/styles/blueprint/src/ie.css +76 -0
  37. data/styles/blueprint/src/print.css +85 -0
  38. data/styles/blueprint/src/reset.css +45 -0
  39. data/styles/blueprint/src/typography.css +106 -0
  40. data/trivial.gemspec +4 -4
  41. data/upgrade-notes/0.0.6.txt +12 -0
  42. data/views/application.inc +1 -0
  43. metadata +39 -4
@@ -0,0 +1 @@
1
+ v0.0.6. Added better asset tags, cachebusters, code cleanup, better documentation, upgrade functionality.
data/Manifest CHANGED
@@ -1,10 +1,43 @@
1
+ CHANGELOG
1
2
  Manifest
2
3
  Rakefile
3
4
  bin/trivialize
5
+ config/trivial.inc
6
+ content/dynamic.inc
4
7
  content/index.html
5
8
  dist/htaccess.dist
6
9
  lib/trivial.php
7
10
  readme.md
8
11
  styles/application.css
9
- trivial.gemspec
12
+ styles/blueprint/LICENSE
13
+ styles/blueprint/ie.css
14
+ styles/blueprint/plugins/buttons/icons/cross.png
15
+ styles/blueprint/plugins/buttons/icons/key.png
16
+ styles/blueprint/plugins/buttons/icons/tick.png
17
+ styles/blueprint/plugins/buttons/readme.txt
18
+ styles/blueprint/plugins/buttons/screen.css
19
+ styles/blueprint/plugins/fancy-type/readme.txt
20
+ styles/blueprint/plugins/fancy-type/screen.css
21
+ styles/blueprint/plugins/link-icons/icons/doc.png
22
+ styles/blueprint/plugins/link-icons/icons/email.png
23
+ styles/blueprint/plugins/link-icons/icons/external.png
24
+ styles/blueprint/plugins/link-icons/icons/feed.png
25
+ styles/blueprint/plugins/link-icons/icons/im.png
26
+ styles/blueprint/plugins/link-icons/icons/pdf.png
27
+ styles/blueprint/plugins/link-icons/icons/visited.png
28
+ styles/blueprint/plugins/link-icons/icons/xls.png
29
+ styles/blueprint/plugins/link-icons/readme.txt
30
+ styles/blueprint/plugins/link-icons/screen.css
31
+ styles/blueprint/plugins/rtl/readme.txt
32
+ styles/blueprint/plugins/rtl/screen.css
33
+ styles/blueprint/print.css
34
+ styles/blueprint/screen.css
35
+ styles/blueprint/src/forms.css
36
+ styles/blueprint/src/grid.css
37
+ styles/blueprint/src/grid.png
38
+ styles/blueprint/src/ie.css
39
+ styles/blueprint/src/print.css
40
+ styles/blueprint/src/reset.css
41
+ styles/blueprint/src/typography.css
42
+ upgrade-notes/0.0.6.txt
10
43
  views/application.inc
data/Rakefile CHANGED
@@ -1,8 +1,9 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
+ require 'fileutils'
4
5
 
5
- Echoe.new('trivial', '0.0.5') do |p|
6
+ Echoe.new('trivial') do |p|
6
7
  p.summary = "Ultra-lightweight website framework for PHP"
7
8
  p.description = <<-EOT
8
9
  For those who are using PHP to build their sites and want a very simple framework
@@ -16,3 +17,17 @@ Echoe.new('trivial', '0.0.5') do |p|
16
17
  p.email = "john@coswelproductions.com"
17
18
  p.url = "http://github.com/johnbintz/trivial"
18
19
  end
20
+
21
+ namespace :blueprint do
22
+ desc "Include the latest Blueprint CSS files"
23
+ task :download do
24
+ FileUtils.rm_r 'blueprint' if File.directory? 'blueprint'
25
+ FileUtils.mkdir 'blueprint'
26
+ Dir.chdir 'blueprint'
27
+ system 'git clone git://github.com/joshuaclayton/blueprint-css.git'
28
+ FileUtils.cp_r File.join('blueprint-css', 'blueprint'), File.join('..', 'styles')
29
+ FileUtils.cp File.join('blueprint-css', 'LICENSE'), File.join('..', 'styles', 'blueprint')
30
+ Dir.chdir '..'
31
+ FileUtils.rm_r 'blueprint'
32
+ end
33
+ end
@@ -6,24 +6,87 @@ if !ARGV[0]
6
6
  exit 1
7
7
  end
8
8
 
9
- puts "Trivializing #{ARGV[0]}"
10
- FileUtils.mkdir ARGV[0] if (!File.directory? ARGV[0])
11
- %w{content actions views scripts styles lib}.each do |dir|
12
- FileUtils.mkdir File.join(ARGV[0], dir) if (!File.directory? File.join(ARGV[0], dir))
13
- end
9
+ class Installer
10
+ def initialize(dest_dir)
11
+ @dest_dir = dest_dir
12
+ end
13
+
14
+ def self.go(dest_dir, &block)
15
+ installer = Installer.new(dest_dir)
16
+ installer.instance_eval &block
17
+ end
18
+
19
+ def mk_mydir
20
+ FileUtils.mkdir @dest_dir if (!File.directory? @dest_dir)
21
+ end
22
+
23
+ def mkdir(dirs)
24
+ dirs.each do |dir|
25
+ FileUtils.mkdir File.join(@dest_dir, dir) if (!File.directory? File.join(@dest_dir, dir))
26
+ end
27
+ end
28
+
29
+ def dest_path(*dest)
30
+ File.join(@dest_dir, *dest)
31
+ end
32
+
33
+ def paths_to_a(*paths)
34
+ paths.collect do |path|
35
+ if path.kind_of? String
36
+ path = path.split('/')
37
+ end
38
+ path
39
+ end
40
+ end
14
41
 
15
- [
16
- [ [File.dirname(__FILE__), '..', 'lib', 'trivial.php'], [ARGV[0], 'lib', 'trivial.php'] ],
17
- [ [File.dirname(__FILE__), '..', 'dist', 'htaccess.dist'], [ARGV[0], '.htaccess'] ],
18
- [ [File.dirname(__FILE__), '..', 'views', 'application.inc'], [ARGV[0], 'views', 'application.inc'] ],
19
- [ [File.dirname(__FILE__), '..', 'content', 'index.html'], [ARGV[0], 'content', 'index.html'] ],
20
- [ [File.dirname(__FILE__), '..', 'styles', 'application.css'], [ARGV[0], 'styles', 'application.css'] ]
21
- ].each do |src, dest|
22
- if !File.exists? File.join(*dest)
23
- FileUtils.cp(File.join(*src), File.join(*dest))
24
- else
25
- puts "Won't overwrite existing #{File.join(*dest)}!"
42
+ def overwrite(source, dest = nil)
43
+ dest = source if (dest == nil)
44
+ source, dest = paths_to_a source, dest
45
+ source_path = File.join(File.dirname(__FILE__), '..', *source)
46
+ if File.directory? source_path
47
+ FileUtils.cp_r source_path, dest_path(*dest)
48
+ else
49
+ FileUtils.cp source_path, dest_path(*dest)
50
+ end
26
51
  end
52
+
53
+ def copy(source, dest = nil)
54
+ dest = source if (dest == nil)
55
+ source, dest = paths_to_a source, dest
56
+ if !File.exists? dest_path(*dest)
57
+ overwrite(source, dest)
58
+ else
59
+ puts "Won't overwrite existing #{dest_path(*dest)}!"
60
+ end
61
+ end
27
62
  end
28
63
 
29
- puts "Done! Make sure you can use .htaccess files in your Webserver setup."
64
+ if ARGV[0] == '--upgrade'
65
+ puts "Upgrading to latest version..."
66
+
67
+ Installer.go(Dir.pwd) do
68
+ mkdir %w{config}
69
+
70
+ overwrite 'lib/trivial.php'
71
+ copy 'config/trivial.inc'
72
+ end
73
+
74
+ puts "Done!"
75
+ else
76
+ puts "Trivializing #{ARGV[0]}"
77
+
78
+ Installer.go(ARGV[0]) do
79
+ mk_mydir
80
+ mkdir %w{content actions views scripts styles lib config}
81
+
82
+ copy 'lib/trivial.php'
83
+ copy 'config/trivial.inc'
84
+ copy 'dist/htaccess.dist', '.htaccess'
85
+ copy 'views/application.inc'
86
+ copy 'content/index.html'
87
+ copy 'styles/application.css'
88
+ overwrite 'styles/blueprint'
89
+ end
90
+
91
+ puts "Done! Make sure you can use .htaccess files in your Webserver setup."
92
+ end
@@ -0,0 +1,3 @@
1
+ <?php
2
+
3
+ $trivial_env = "development";
@@ -0,0 +1 @@
1
+ <?php echo "hello world!" ?>
@@ -1,15 +1,41 @@
1
1
  <?php
2
2
 
3
- // If you're using a different global default layout name, change it here
4
- $layout = 'application';
3
+ define('TRIVIAL_VERSION', '0.0.6');
4
+
5
+ // PUT SITE CONFIGURATION IN config/trivial.inc
5
6
 
6
7
  if (!isset($_SERVER['REDIRECT_URL'])) {
7
8
  header('HTTP/1.1 403 Forbidden');
8
9
  exit(1);
9
10
  }
10
11
 
11
- // END OF USER-CONFIGURABLE SETTINGS
12
+ $root_dir = realpath(dirname(__FILE__) . '/../');
13
+
14
+ // All of these should be set within config/trivial.inc!
15
+
16
+ // The default layout.
17
+ $layout = 'application';
18
+
19
+ // Additional scripts and stylesheets can be loaded in this way. Blueprint does not get loaded this way.
20
+ $global_head = array('scripts' => array(), 'styles' => array());
21
+
22
+ // If the environment is anything but production, errors will be rendered in the page.
23
+ $trivial_env = 'development';
24
+
25
+ if (($config = fe_check('config/trivial.inc')) !== false) {
26
+ include($config);
27
+ }
28
+
29
+ $trim = str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', realpath($root_dir));
12
30
 
31
+ $requested = preg_replace('#/$#', '/index.html', $_SERVER['REDIRECT_URL']);
32
+ $requested = preg_replace("#${trim}/(.*)\.[^\.]+\$#", '\1', $requested);
33
+
34
+ /**
35
+ * Check the root path for the requested file.
36
+ * @param string $path The path to look for.
37
+ * @return string The path to the file on the filesystem, or false if not found.
38
+ */
13
39
  function fe_check($path) {
14
40
  global $root_dir;
15
41
  if (file_exists($full_path = ($root_dir . '/' . $path))) {
@@ -19,6 +45,13 @@ function fe_check($path) {
19
45
  }
20
46
  }
21
47
 
48
+ /**
49
+ * Load a partial file.
50
+ * Partials live in the views directory and are prefixed with an underscore (ex: section/_a_partial.inc).
51
+ * @param string $name The name of the partial without the leading underscore (ex: section/a_partial).
52
+ * @param array $local A hash of variables to include into the local scope of the partial.
53
+ * @return string The partial's result.
54
+ */
22
55
  function partial($name, $local = array()) {
23
56
  $name = preg_replace('#/([^/]+)$', '/_\1', $name);
24
57
  if (($path = fe_check('views/' . $name . '.inc')) !== false) {
@@ -27,62 +60,155 @@ function partial($name, $local = array()) {
27
60
  include($path);
28
61
  return ob_get_clean();
29
62
  } else {
30
- trigger_error("No partial named ${name} found!");
63
+ render_error("No partial named ${name} found!");
31
64
  }
32
65
  }
33
66
 
34
- $root_dir = realpath(dirname(__FILE__) . '/../');
35
-
36
- $trim = str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', realpath($root_dir));
37
-
38
- $requested = preg_replace('#/$#', '/index.html', $_SERVER['REDIRECT_URL']);
39
- $requested = preg_replace("#${trim}/(.*)\.[^\.]+\$#", '\1', $requested);
67
+ /**
68
+ * Handle a rendering error.
69
+ * If the environment is 'production', the error is only logged. If it's anything else, it's printed
70
+ * on the screen. Regardless, an HTTP 500 error is returned and processing stops.
71
+ * @param string $error The error message to display.
72
+ */
73
+ function render_error($error) {
74
+ global $trivial_env;
75
+ if ($trivial_env == 'production') {
76
+ error_log($error);
77
+ } else {
78
+ echo "<div id='trivial-error'>${error}</div>";
79
+ }
80
+ header('HTTP/1.1 500 Internal Server Error');
81
+ exit(1);
82
+ }
40
83
 
84
+ /**
85
+ * Render style link tags.
86
+ */
41
87
  function styles() {
42
- return head_component(func_get_args(), 'styles/%s.css', '<link rel="stylesheet" href="styles/%s.css" type="text/css" />');
88
+ return head_component('style', func_get_args());
43
89
  }
44
90
 
91
+ /**
92
+ * Render script tags.
93
+ */
45
94
  function scripts() {
46
- return head_component(func_get_args(), 'scripts/%s.js', '<script type="text/javascript" src="scripts/%s.js"></script>');
95
+ return head_component('script', func_get_args());
96
+ }
97
+
98
+ /**
99
+ * Render a style tag.
100
+ */
101
+ function style($name, $additional = '') {
102
+ return asset($name, 'styles/%s.css', '<link rel="stylesheet" href="styles/%s.css%s" type="text/css" %s/>', true, $additional);
103
+ }
104
+
105
+ /**
106
+ * Render a script tag.
107
+ */
108
+ function script($name) {
109
+ return asset($name, 'scripts/%s.js', '<script type="text/javascript" src="scripts/%s.js%s"></script>');
110
+ }
111
+
112
+ /**
113
+ * Render an asset tag, busting the cache if necessary.
114
+ */
115
+ function asset($name, $search, $format, $bust_cache = true, $additional = '') {
116
+ if (($file = fe_check(sprintf($search, $name))) !== false) {
117
+ return sprintf($format, $name, $bust_cache ? cachebuster($file) : '', $additional);
118
+ }
119
+ return '';
120
+ }
121
+
122
+ /**
123
+ * Get a cachebuster string for a file.
124
+ */
125
+ function cachebuster($file) {
126
+ if (file_exists($file)) {
127
+ return '?' . filemtime($file);
128
+ } else {
129
+ return '';
130
+ }
47
131
  }
48
132
 
49
- function head_component($additional, $search, $format) {
50
- global $requested;
133
+ /**
134
+ * Render head compoments.
135
+ * @param string $what The type of component to render. $global_head is searched for a matching key and values for that key are merged into the list of styles.
136
+ * @param array $additional An array of additional components to display.
137
+ * @param string $search The search pattern to use for each component, run through sprintf() with the first %s being replaced with the component name.
138
+ * @param string $format The output format of the HTML tag to bring in the content.
139
+ * @return string The HTML for all found components.
140
+ */
141
+ function head_component($what, $additional = array()) {
142
+ global $requested, $global_head;
51
143
 
52
144
  $output = array();
53
- foreach (array_merge(array('application', $requested), $additional) as $file) {
54
- if (fe_check(sprintf($search, $file)) !== false) {
55
- $output[] = sprintf($format, $file);
56
- }
145
+
146
+ $components = $additional;
147
+
148
+ if (isset($global_head[$what]) && is_array($global_head[$what])) {
149
+ $components = array_merge($components, $global_head[$what]);
57
150
  }
151
+
152
+ $components = array_merge($components, array('application', $requested));
153
+
154
+ foreach ($components as $name) { $output[] = call_user_func($what, $name); }
58
155
  return implode("\n", $output);
59
156
  }
60
157
 
158
+ /**
159
+ * Get the code to embed the Blueprint CSS framework.
160
+ * You should be starting with Blueprint and working your way from there, if only for the CSS reset & IE fixes alone.
161
+ * @return string The HTML for Blueprint.
162
+ */
163
+ function blueprint() {
164
+ $output = array();
165
+ $output[] = style('blueprint/screen', 'media="screen, projection"');
166
+ $output[] = style('blueprint/print', 'media="print"');
167
+ $output[] = '<!--[if lte IE 8]>';
168
+ $output[] = style('blueprint/ie', 'media="screen, projection"');
169
+ $output[] = '<![endif]-->';
170
+ return implode('', $output);
171
+ }
172
+
173
+ // Search for files in the content directory, starting with .inc files (which will be include()d), then .html files (which will be file_get_content()sed)
61
174
  $content = null;
62
- if (($content_file = fe_check('content/' . $requested . '.html')) !== false) {
63
- $content = file_get_contents($content_file);
175
+ if (($content_file = fe_check('content/' . $requested . '.inc')) !== false) {
176
+ ob_start();
177
+ include($content_file);
178
+ $content = ob_get_clean();
179
+ } else {
180
+ if (($content_file = fe_check('content/' . $requested . '.html')) !== false) {
181
+ $content = file_get_contents($content_file);
182
+ }
64
183
  }
65
184
 
185
+ // Look for an action for the request. If it's found, execute it. Remember, $content contains the result of the above operation, if something was found.
66
186
  foreach (array('application', $requested) as $action) {
67
187
  if (($action_file = fe_check('actions/' . $action . '.inc')) !== false) {
68
188
  include($action_file);
69
189
  }
70
190
  }
71
191
 
192
+ // Look for a view with the same name as the request. If it's found, include() it, wrapping the include() in an output buffer block.
72
193
  if (($view_file = fe_check('views/' . $requested . '.inc')) !== false) {
73
194
  ob_start();
74
195
  include($view_file);
75
196
  $content = ob_get_clean();
76
197
  }
77
198
 
199
+ // We should have content by this point. If not, raise an error.
78
200
  if (is_null($content)) {
79
- trigger_error("No content generated for ${requested}! Did you create a content, action, or view file for this request?");
201
+ render_error("No content generated for ${requested}! Did you create a content, action, or view file for this request?");
80
202
  }
81
203
 
204
+ // We should have a layout, too. If not, raise an error.
82
205
  if (($layout_file = fe_check('views/' . $layout . '.inc')) !== false) {
83
206
  ob_start();
84
207
  include($layout_file);
85
208
  $content = ob_get_clean();
209
+ } else {
210
+ render_error("Layout not found: ${layout}");
86
211
  }
87
212
 
213
+ // We're done!
88
214
  echo $content;
data/readme.md CHANGED
@@ -16,22 +16,96 @@ A new binary is created, `trivialize`.
16
16
 
17
17
  A directory called `my-new-site` will be created with the site structure in place. An example `content/index.html` and `views/application.inc` will also be installed.
18
18
 
19
+ ## Upgrading an existing site
20
+
21
+ Backup your existing site folder, `cd` to the site folder and type:
22
+
23
+ `trivialize --upgrade`
24
+
25
+ The following files will be overwritten:
26
+
27
+ * `lib/trivial.php`
28
+ * `styles/blueprint`
29
+
30
+ And if they don't exist, the following files will be created:
31
+
32
+ * `config/trivial.inc`
33
+
19
34
  ## The request process
20
35
 
21
36
  When a request comes in to that directory for a file that doesn't exist, trivial
22
37
  does the following (for the examples, the request was for `about_us/contact.html` and the default `$layout` value is `"application"`):
23
38
 
24
- * The `content` folder is checked for a `.html` file that matches the path (`content/about_us/contact.html`). If it exists, the contents of the file are pulled into the global `$content` variable.
39
+ * The `content` folder is checked for an `.html` or `.inc` file that matches the path (`content/about_us/contact.html`).
40
+ * If a `.html` file exists, the contents of the file are pulled into the global `$content` variable.
41
+ * If a `.inc` file exists, the file is include()d and the output is placed into the global `$content` variable.
25
42
  * The `actions` folder is checked for two files:
26
43
  * `actions/application.inc`
27
44
  * `actions/about_us/contact.inc`
28
- Each found file is included into the program, potentially modifying `$content` or `$layout`.
45
+ Each found file is included into the program in that order, potentially modifying `$content` or `$layout`.
29
46
  * The `views` folder is checked for two files:
30
47
  * `views/about_us/contact.inc`
31
48
  * `views/application.inc`
32
49
  Each found file is included into the program, including `$content` where specified and outputting back into `$content`.
50
+ A layout *must exist* or an error will occur.
33
51
  * The value of `$content` is output to the visitor.
34
52
 
35
53
  ## Styles and scripts
36
54
 
37
- Styles and scripts can be searched for in a structured way. The included `views/application.inc` gives an example as to how this works.
55
+ By default, the provided `views/application.inc` file has three functions for including stylesheets and scripts:
56
+
57
+ <head>
58
+ <?php echo blueprint() ?>
59
+ <?php echo scripts() ?>
60
+ <?php echo styles() ?>
61
+ </head>
62
+
63
+ ### Blueprint
64
+
65
+ The latest [Blueprint CSS Framework](http://blueprintcss.org/) comes with Trivial. It's included into the defaut application.inc layout
66
+ with the `blueprint()` function. Blueprint's licence can be found in the `styles/blueprint` directory.
67
+
68
+ ### Other Styles and Scripts
69
+
70
+ The `scripts()` and `styles()` functions, by default, only search for files named `application.ext` and `name/of/request.ext`.
71
+ For the request `contact/about_us.html`, the following JavaScript and CSS files will be searched for, in this order:
72
+
73
+ * `scripts/application.js`
74
+ * `scripts/contact/about_us.js`
75
+ * `styles/application.css`
76
+ * `styles/contact/about_us.css`
77
+
78
+ You can incude other scripts and stylesheets in several ways:
79
+
80
+ #### Globally, before application- and page-specific includes
81
+
82
+ Inside of `config/trivial.inc`, add the following variable definition:
83
+
84
+ `$global_head = array('scripts' => array(), 'styles' => array());`
85
+
86
+ In the `scripts` and `styles` arrays, add the names of the other files to include, not including the extension:
87
+
88
+ `$global_head = array('scripts' => array('jquery-1.4.2.min'), 'styles' => array('client'));`
89
+
90
+ These scripts are loaded before the ones listed above, so the new search path becomes:
91
+
92
+ * `scripts/jquery-1.4.2.min.js`
93
+ * `scripts/application.js`
94
+ * `scripts/contact/about_us.js`
95
+ * `styles/client.css`
96
+ * `styles/application.css`
97
+ * `styles/contact/about_us.css`
98
+
99
+ #### Locally, via a view, before application- and page-specific includes
100
+
101
+ In your view, modify `$global_head` as you would above.
102
+
103
+ #### Within the layout, without adding new script() or style() tags
104
+
105
+ Adding additional parameters to the `scripts()` or `styles()` tag works the same as adding items to the `$global_head`:
106
+
107
+ `<?php echo scripts('jquery-1.4.2.min') ?>`
108
+ `<?php echo styles('client') ?>`
109
+
110
+ Scripts/styles defined in the tag itself are loaded before `$global_head`.
111
+