[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
|
### Manifest Declarations
|
||||||
|
|
||||||
There are five kinds of manifest declarations:
|
There are six kinds of manifest declarations:
|
||||||
|
|
||||||
1. `stylesheet` - Declares a sass file.
|
1. `stylesheet` - Declares a sass file.
|
||||||
2. `image` - Declares an image.
|
2. `image` - Declares an image.
|
||||||
3. `javascript` - Declares a javascript file.
|
3. `javascript` - Declares a javascript file.
|
||||||
4. `html` - Declares an html file.
|
4. `html` - Declares an html file.
|
||||||
5. `file` - Declares a random 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
|
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
|
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
|
* `:condition` - this is used to hint the user that a conditional comment should be
|
||||||
used to import the stylesheet with the given condition.
|
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:
|
HTML files:
|
||||||
|
|
||||||
You can provide html as haml or as plain html. If you provide haml, the haml will be
|
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}"
|
"#{pattern_name_as_dir}#{to}"
|
||||||
end
|
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
|
alias install_html_without_haml install_html
|
||||||
def install_html(from, to, options)
|
def install_html(from, to, options)
|
||||||
if to =~ /\.haml$/
|
if to =~ /\.haml$/
|
||||||
|
@ -40,6 +40,7 @@ module Compass
|
|||||||
type :font
|
type :font
|
||||||
type :file
|
type :file
|
||||||
type :html
|
type :html
|
||||||
|
type :directory
|
||||||
|
|
||||||
def help(value = nil)
|
def help(value = nil)
|
||||||
if value
|
if value
|
||||||
|
@ -17,9 +17,11 @@ module Compass
|
|||||||
# Initializes the project to work with compass
|
# Initializes the project to work with compass
|
||||||
def init
|
def init
|
||||||
dirs = manifest.map do |entry|
|
dirs = manifest.map do |entry|
|
||||||
loc = send("install_location_for_#{entry.type}", entry.to, entry.options)
|
unless entry.type == :directory
|
||||||
File.dirname(loc)
|
loc = send("install_location_for_#{entry.type}", entry.to, entry.options)
|
||||||
end
|
File.dirname(loc)
|
||||||
|
end
|
||||||
|
end.compact
|
||||||
|
|
||||||
if manifest.has_stylesheet?
|
if manifest.has_stylesheet?
|
||||||
dirs << sass_dir
|
dirs << sass_dir
|
||||||
|
Loading…
Reference in New Issue
Block a user