[Extensions] Make it possible for extensions to create empty directories. Closes GH-173.
This commit is contained in:
parent
dafbf93999
commit
755b9a3a11
@ -165,13 +165,14 @@ You may also see some real manifest files here:
|
||||
|
||||
### Manifest Declarations
|
||||
|
||||
There are five kinds of manifest declarations:
|
||||
There are six kinds of manifest declarations:
|
||||
|
||||
1. `stylesheet` - Declares a sass file.
|
||||
2. `image` - Declares an image.
|
||||
3. `javascript` - Declares a javascript file.
|
||||
4. `html` - Declares an html file.
|
||||
5. `file` - Declares a random file.
|
||||
6. `directory` - Declares a directory should be created.
|
||||
|
||||
All declarations take the path to the file as their first argument. Note that the
|
||||
normal slash `/` can and should be used in a manifest. Compass will take care of
|
||||
@ -196,6 +197,15 @@ Stylesheet options:
|
||||
* `:condition` - this is used to hint the user that a conditional comment should be
|
||||
used to import the stylesheet with the given condition.
|
||||
|
||||
Directory options:
|
||||
|
||||
* `:within` - where the directory should be created. If omitted, the directory
|
||||
will be relative to the project directory. Can be one of: the following
|
||||
* `sass_dir`
|
||||
* `javascripts_dir`
|
||||
* `fonts_dir`
|
||||
* `images_dir`
|
||||
|
||||
HTML files:
|
||||
|
||||
You can provide html as haml or as plain html. If you provide haml, the haml will be
|
||||
|
@ -116,6 +116,19 @@ module Compass
|
||||
"#{pattern_name_as_dir}#{to}"
|
||||
end
|
||||
|
||||
def install_directory(from, to, options)
|
||||
d = if within = options[:within]
|
||||
if respond_to?(within)
|
||||
targetize("#{send(within)}/#{to}")
|
||||
else
|
||||
raise Compass::Error, "Unrecognized location: #{within}"
|
||||
end
|
||||
else
|
||||
targetize(to)
|
||||
end
|
||||
directory d
|
||||
end
|
||||
|
||||
alias install_html_without_haml install_html
|
||||
def install_html(from, to, options)
|
||||
if to =~ /\.haml$/
|
||||
|
@ -40,6 +40,7 @@ module Compass
|
||||
type :font
|
||||
type :file
|
||||
type :html
|
||||
type :directory
|
||||
|
||||
def help(value = nil)
|
||||
if value
|
||||
|
@ -17,9 +17,11 @@ module Compass
|
||||
# Initializes the project to work with compass
|
||||
def init
|
||||
dirs = manifest.map do |entry|
|
||||
loc = send("install_location_for_#{entry.type}", entry.to, entry.options)
|
||||
File.dirname(loc)
|
||||
end
|
||||
unless entry.type == :directory
|
||||
loc = send("install_location_for_#{entry.type}", entry.to, entry.options)
|
||||
File.dirname(loc)
|
||||
end
|
||||
end.compact
|
||||
|
||||
if manifest.has_stylesheet?
|
||||
dirs << sass_dir
|
||||
|
Loading…
Reference in New Issue
Block a user