David Carr  committed a822e3d

Add gdocs

  • Participants
  • Parent commits 0a6d021
  • Branches default

Comments (0)

Files changed (4)

File src/docs/guide/introduction.gdoc

+The Page Resources plugin provides the [Grails Resources plugin|] with the ability to
+use convention over configuration to define "page modules", which allow having page-specific
+JavaScript/CSS/LESS resources.  This can drastically cut down on the number of resource modules that need to be
+configured explicitly.

File src/docs/guide/releaseNotes.gdoc

+Below is the history of Page Resource plugin releases.
+h4. 0.1 (Release TBD)
+* Initial release

File src/docs/guide/toc.yml

+  title: Introduction
+  releaseNotes: Release Notes
+usage: Usage

File src/docs/guide/usage.gdoc

+h4. First, install the plugin by adding a dependency in @BuildConfig.groovy@:
+plugins {
+   ...
+   runtime ':page-resources:0.1'
+or install with @install-plugin@:
+grails install-plugin page-resources
+h4. Creating page modules
+Next, you'll need to create some page modules.  Within @web-app/pages@, create a directory structure that parallels the
+path to a view.  For example, if you have a file @grails-app/views/user/view.gsp@, you would create directory
+@web-app/pages/user/view@.  Create any page-specific resources that you want the view to include in this directory.
+For example, if the page requires special styling you can add .css or .less files, or if the page requires special
+Javascript behavior you can add .js files.  For every such directory that contains files, a resource module will be
+automatically created, and the view will automatically require it.  In this example, the module would be named
+"pages_user_view" (the directory path with slashes replaced with underscores).  Files in the directory are included
+in the module in alphabetical order.
+h4. Default page dependencies
+You may have some JavaScript libraries that your page-specific scripts use.  A JavaScript framework such as jQuery
+would be a common example of this.  You need to tell the resources plugin about these dependencies, or they may be
+included in the wrong ordering, resulting in JavaScript errors.  These situations can often be resolved using a default
+page dependencies module.  If you
+[declare a resource module|]
+named @defaultPageDependencies@, the page modules will automatically list it as a dependency.  If you list all your
+commonly used libraries as dependencies in your @defaultPageDependencies@ module, you generally won't need to do any
+page-specific configuration for most views.  If you need to list dependencies not appropriate for the default page
+dependencies, please see the "Explicit page module definitions" section below.
+h4. Explicit page module definitions
+In some cases, you may need additional control over the contents of the resource module for a page.  Examples of this
+include when you need to vary from the default page dependencies, when you need to include additional resources in
+the page module, or when you need to specify special processing for particular resources in the module.  In these cases,
+[declare a resource module|]
+with the same name as would have been automatically created (pages_*PATH*_*VIEWNAME*).  The Page Resources plugin will
+use your definition for the module rather than automatically create one, and will still automatically require the module
+in the view.