You should place static.rb in lib/ or a subdirectory of lib/.
Your assets/ directory should be a sibling of content/, and you need
to configure the static data-source to point at your assets/ directory
via config.yaml. For instance, your config.yaml might contain this:
This configures the data-source "filesystem_unified" in the typical
fashion, and then configures the additional static data-source
"assets". In your Rules file, if you need special handling of static
assets, you can name them via identifiers like this:
> Where do you need to save the static.rb file to? Is it to /lib or somewhere
> else?
> Also should the assets/ dir be under content/, or a sibling to content/
> Sorry for the silly newbie question. I'm sort of learning Ruby as I go, so
> it's all a little bit overwhelming at the moment ;-)
> REgards,
> Andrew.
> --
> You received this message because you are subscribed to the nanoc
> discusssion group.
> To post to this group, send email to nanoc@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en
On Monday, May 21, 2012 7:53:51 PM UTC+10, Eric Sunshine wrote: > You should place static.rb in lib/ or a subdirectory of lib/.
> Your assets/ directory should be a sibling of content/, and you need > to configure the static data-source to point at your assets/ directory > via config.yaml. For instance, your config.yaml might contain this:
> This configures the data-source "filesystem_unified" in the typical > fashion, and then configures the additional static data-source > "assets". In your Rules file, if you need special handling of static > assets, you can name them via identifiers like this:
> compile '/assets/*/' do > # ...process... > end
> route '/assets/*/' do > # ...compose name... > end
On Sun, Jul 8, 2012 at 5:37 PM, Nathanael Phillips <n...@coffeebot.net> wrote:
> * My folder structure has content and assets as siblings ("/nanoc/content"
> and "/nanoc/assets").
> * config.yaml is:
> -
> type: static
> items_root: /assets
It's not clear from this excerpt if this configuration information
resides under the 'data_sources' key. If not, that could be a problem.
> * rules.rb has:
> route '/assets/*/' do
> "/assets/" + File.basename(item.identifier.chop) + item[:extension]
> end
This looks a bit suspect. For the static data-source, item.identifier
already contains the file extension, so there is no need to add it
again. Moreover, this rule is flattening the source /assets hierarchy
into a single output /assets directory. Is this really intended?
Typically, you could get by with the following much simpler rule which
retains the directory hierarchy:
route '/assets/*/' do
item.identifier.chop
end
> There are no compile errors, but at the same time, the assets don't appear
> in the output folder.
You could try examining the output of the nanoc subcommand
'show-plugins' to see if your static data-source is even recognized.
If it is, subcommands 'show-data' and 'show-rules' might tell you what
nanoc intends to do with the static items.
The main purpose is that they've built their site quite close to how I'm structuring mine, and it was a great way to learn nanoc. Now that I have some time with it under my belt, I'm wondering if I need to start from scratch....
On Monday, July 9, 2012 2:56:33 PM UTC-7, Eric Sunshine wrote:
> Hi Nathaniel,
> Comments below...
> On Sun, Jul 8, 2012 at 5:37 PM, Nathanael Phillips <n...@coffeebot.net> > wrote: > > * My folder structure has content and assets as siblings > ("/nanoc/content" > > and "/nanoc/assets"). > > * config.yaml is: > > - > > type: static > > items_root: /assets
> It's not clear from this excerpt if this configuration information > resides under the 'data_sources' key. If not, that could be a problem.
> > * rules.rb has: > > route '/assets/*/' do > > "/assets/" + File.basename(item.identifier.chop) + item[:extension] > > end
> This looks a bit suspect. For the static data-source, item.identifier > already contains the file extension, so there is no need to add it > again. Moreover, this rule is flattening the source /assets hierarchy > into a single output /assets directory. Is this really intended? > Typically, you could get by with the following much simpler rule which > retains the directory hierarchy:
> route '/assets/*/' do > item.identifier.chop > end
> > There are no compile errors, but at the same time, the assets don't > appear > > in the output folder.
> You could try examining the output of the nanoc subcommand > 'show-plugins' to see if your static data-source is even recognized. > If it is, subcommands 'show-data' and 'show-rules' might tell you what > nanoc intends to do with the static items.
The problem is that the static data-source assumes that the source
directory containing static assets is named "static". If you want to
use a source directory named "assets", then you need to configure the
data source as such:
> The main purpose is that they've built their site quite close to how I'm
> structuring mine, and it was a great way to learn nanoc. Now that I have
> some time with it under my belt, I'm wondering if I need to start from
> scratch....
> On Monday, July 9, 2012 2:56:33 PM UTC-7, Eric Sunshine wrote:
>> Hi Nathaniel,
>> Comments below...
>> On Sun, Jul 8, 2012 at 5:37 PM, Nathanael Phillips <n...@coffeebot.net>
>> wrote:
>> > * My folder structure has content and assets as siblings
>> > ("/nanoc/content"
>> > and "/nanoc/assets").
>> > * config.yaml is:
>> > -
>> > type: static
>> > items_root: /assets
>> It's not clear from this excerpt if this configuration information
>> resides under the 'data_sources' key. If not, that could be a problem.
>> > * rules.rb has:
>> > route '/assets/*/' do
>> > "/assets/" + File.basename(item.identifier.chop) + item[:extension]
>> > end
>> This looks a bit suspect. For the static data-source, item.identifier
>> already contains the file extension, so there is no need to add it
>> again. Moreover, this rule is flattening the source /assets hierarchy
>> into a single output /assets directory. Is this really intended?
>> Typically, you could get by with the following much simpler rule which
>> retains the directory hierarchy:
>> route '/assets/*/' do
>> item.identifier.chop
>> end
>> > There are no compile errors, but at the same time, the assets don't
>> > appear
>> > in the output folder.
>> You could try examining the output of the nanoc subcommand
>> 'show-plugins' to see if your static data-source is even recognized.
>> If it is, subcommands 'show-data' and 'show-rules' might tell you what
>> nanoc intends to do with the static items.
>> -- ES
> --
> You received this message because you are subscribed to the nanoc
> discusssion group.
> To post to this group, send email to nanoc@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en
One other point: Rules match from top to bottom (first to last). Make
sure that the 'compile' and 'route' rules for your static assets
appear in Rules file before the catch-all compile/route rules match
wildcard '*' to ensure nanoc does not ignore your static asset rules.
On Tue, Jul 10, 2012 at 12:15 AM, Eric Sunshine <sunsh...@sunshineco.com> wrote:
> The problem is that the static data-source assumes that the source
> directory containing static assets is named "static". If you want to
> use a source directory named "assets", then you need to configure the
> data source as such:
> Note the new 'prefix' key. Its value is relative to your top-level
> project directory (hence no leading "/").
> (On my own site, I use the default source name "static", so I neither
> ran into the issue nor thought about it when I replied originally to
> Andrew.)
> -- ES
> On Mon, Jul 9, 2012 at 11:40 PM, Nathanael Phillips <n...@coffeebot.net> wrote:
>> Thanks for the quick response, Eric!
>> the static configuration is under the data_sources key.
>> from show-plugins:
>> Data Sources:
>> The main purpose is that they've built their site quite close to how I'm
>> structuring mine, and it was a great way to learn nanoc. Now that I have
>> some time with it under my belt, I'm wondering if I need to start from
>> scratch....
>> On Monday, July 9, 2012 2:56:33 PM UTC-7, Eric Sunshine wrote:
>>> Hi Nathaniel,
>>> Comments below...
>>> On Sun, Jul 8, 2012 at 5:37 PM, Nathanael Phillips <n...@coffeebot.net>
>>> wrote:
>>> > * My folder structure has content and assets as siblings
>>> > ("/nanoc/content"
>>> > and "/nanoc/assets").
>>> > * config.yaml is:
>>> > -
>>> > type: static
>>> > items_root: /assets
>>> It's not clear from this excerpt if this configuration information
>>> resides under the 'data_sources' key. If not, that could be a problem.
>>> > * rules.rb has:
>>> > route '/assets/*/' do
>>> > "/assets/" + File.basename(item.identifier.chop) + item[:extension]
>>> > end
>>> This looks a bit suspect. For the static data-source, item.identifier
>>> already contains the file extension, so there is no need to add it
>>> again. Moreover, this rule is flattening the source /assets hierarchy
>>> into a single output /assets directory. Is this really intended?
>>> Typically, you could get by with the following much simpler rule which
>>> retains the directory hierarchy:
>>> route '/assets/*/' do
>>> item.identifier.chop
>>> end
>>> > There are no compile errors, but at the same time, the assets don't
>>> > appear
>>> > in the output folder.
>>> You could try examining the output of the nanoc subcommand
>>> 'show-plugins' to see if your static data-source is even recognized.
>>> If it is, subcommands 'show-data' and 'show-rules' might tell you what
>>> nanoc intends to do with the static items.
>>> -- ES
>> --
>> You received this message because you are subscribed to the nanoc
>> discusssion group.
>> To post to this group, send email to nanoc@googlegroups.com
>> To unsubscribe from this group, send email to
>> nanoc+unsubscribe@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/nanoc?hl=en
On Monday, July 9, 2012 9:18:22 PM UTC-7, Eric Sunshine wrote:
> One other point: Rules match from top to bottom (first to last). Make > sure that the 'compile' and 'route' rules for your static assets > appear in Rules file before the catch-all compile/route rules match > wildcard '*' to ensure nanoc does not ignore your static asset rules.
> -- ES
> On Tue, Jul 10, 2012 at 12:15 AM, Eric Sunshine wrote: > > The problem is that the static data-source assumes that the source > > directory containing static assets is named "static". If you want to > > use a source directory named "assets", then you need to configure the > > data source as such:
> > Note the new 'prefix' key. Its value is relative to your top-level > > project directory (hence no leading "/").
> > (On my own site, I use the default source name "static", so I neither > > ran into the issue nor thought about it when I replied originally to > > Andrew.)
> > -- ES
> > On Mon, Jul 9, 2012 at 11:40 PM, Nathanael Phillips wrote: > >> Thanks for the quick response, Eric!
> >> the static configuration is under the data_sources key. > >> from show-plugins: > >> Data Sources:
> >> The main purpose is that they've built their site quite close to how > I'm > >> structuring mine, and it was a great way to learn nanoc. Now that I > have > >> some time with it under my belt, I'm wondering if I need to start from > >> scratch....
> >> On Monday, July 9, 2012 2:56:33 PM UTC-7, Eric Sunshine wrote:
> >>> Hi Nathaniel,
> >>> Comments below...
> >>> On Sun, Jul 8, 2012 at 5:37 PM, Nathanael Phillips > >>> wrote: > >>> > * My folder structure has content and assets as siblings > >>> > ("/nanoc/content" > >>> > and "/nanoc/assets"). > >>> > * config.yaml is: > >>> > - > >>> > type: static > >>> > items_root: /assets
> >>> It's not clear from this excerpt if this configuration information > >>> resides under the 'data_sources' key. If not, that could be a problem.
> >>> This looks a bit suspect. For the static data-source, item.identifier > >>> already contains the file extension, so there is no need to add it > >>> again. Moreover, this rule is flattening the source /assets hierarchy > >>> into a single output /assets directory. Is this really intended? > >>> Typically, you could get by with the following much simpler rule which > >>> retains the directory hierarchy:
> >>> route '/assets/*/' do > >>> item.identifier.chop > >>> end
> >>> > There are no compile errors, but at the same time, the assets don't > >>> > appear > >>> > in the output folder.
> >>> You could try examining the output of the nanoc subcommand > >>> 'show-plugins' to see if your static data-source is even recognized. > >>> If it is, subcommands 'show-data' and 'show-rules' might tell you what > >>> nanoc intends to do with the static items.
> >>> -- ES
> >> -- > >> You received this message because you are subscribed to the nanoc > >> discusssion group.
> >> To post to this group, send email to nanoc@googlegroups.com > >> To unsubscribe from this group, send email to > >> nanoc+unsubscribe@googlegroups.com > >> For more options, visit this group at > >> http://groups.google.com/group/nanoc?hl=en
Is it possible to filter files from the static data source? My static folder is named "assets", I tried this:
compile "/assets/*/" do
puts item.identifier.chop case item[:extension]
when 'scss' if File.basename(item.identifier) == "app.scss"
filter :sass, sass_options
filter :relativize_paths, type: :css
end
when "coffee"
filter :coffeescript
endend
but when I try to compile, an error is raised:
Nanoc::Errors::CannotUseTextualFilter: The “Nanoc::Filters::Sass” filter cannot be used to filter the “/assets/stylesheets/app.scss/” item (rep “default”), because textual filters cannot be used on binary items.
Any idea why nanoc considers app.scss as a binary file?
On Wednesday, July 11, 2012 5:02:37 AM UTC+2, Nathanael Phillips wrote:
> Perfect, thanks! The prefix option worked like a charm :)
> Thanks for the tip, and pointing out the power of the data-source and > other subfunctions!
> On Monday, July 9, 2012 9:18:22 PM UTC-7, Eric Sunshine wrote:
>> One other point: Rules match from top to bottom (first to last). Make >> sure that the 'compile' and 'route' rules for your static assets >> appear in Rules file before the catch-all compile/route rules match >> wildcard '*' to ensure nanoc does not ignore your static asset rules.
>> -- ES
>> On Tue, Jul 10, 2012 at 12:15 AM, Eric Sunshine wrote: >> > The problem is that the static data-source assumes that the source >> > directory containing static assets is named "static". If you want to >> > use a source directory named "assets", then you need to configure the >> > data source as such:
>> > Note the new 'prefix' key. Its value is relative to your top-level >> > project directory (hence no leading "/").
>> > (On my own site, I use the default source name "static", so I neither >> > ran into the issue nor thought about it when I replied originally to >> > Andrew.)
>> > -- ES
>> > On Mon, Jul 9, 2012 at 11:40 PM, Nathanael Phillips wrote: >> >> Thanks for the quick response, Eric!
>> >> the static configuration is under the data_sources key. >> >> from show-plugins: >> >> Data Sources:
>> >> The main purpose is that they've built their site quite close to how >> I'm >> >> structuring mine, and it was a great way to learn nanoc. Now that I >> have >> >> some time with it under my belt, I'm wondering if I need to start from >> >> scratch....
>> >> On Monday, July 9, 2012 2:56:33 PM UTC-7, Eric Sunshine wrote:
>> >>> Hi Nathaniel,
>> >>> Comments below...
>> >>> On Sun, Jul 8, 2012 at 5:37 PM, Nathanael Phillips
>> >>> wrote: >> >>> > * My folder structure has content and assets as siblings >> >>> > ("/nanoc/content" >> >>> > and "/nanoc/assets"). >> >>> > * config.yaml is: >> >>> > - >> >>> > type: static >> >>> > items_root: /assets
>> >>> It's not clear from this excerpt if this configuration information >> >>> resides under the 'data_sources' key. If not, that could be a >> problem.
>> >>> This looks a bit suspect. For the static data-source, item.identifier >> >>> already contains the file extension, so there is no need to add it >> >>> again. Moreover, this rule is flattening the source /assets hierarchy >> >>> into a single output /assets directory. Is this really intended? >> >>> Typically, you could get by with the following much simpler rule >> which >> >>> retains the directory hierarchy:
>> >>> route '/assets/*/' do >> >>> item.identifier.chop >> >>> end
>> >>> > There are no compile errors, but at the same time, the assets don't >> >>> > appear >> >>> > in the output folder.
>> >>> You could try examining the output of the nanoc subcommand >> >>> 'show-plugins' to see if your static data-source is even recognized. >> >>> If it is, subcommands 'show-data' and 'show-rules' might tell you >> what >> >>> nanoc intends to do with the static items.
>> >>> -- ES
>> >> -- >> >> You received this message because you are subscribed to the nanoc >> >> discusssion group.
>> >> To post to this group, send email to na...@googlegroups.com<javascript:> >> >> To unsubscribe from this group, send email to >> >> nanoc+un...@googlegroups.com <javascript:> >> >> For more options, visit this group at >> >> http://groups.google.com/group/nanoc?hl=en
You could reprogram the datasource to assign binary status
dynamically. Alternately, a work-around would be to add a 'preprocess'
block to your Rules file which assigns 'false' to the :binary
attribute of each item with .scss extension.
<matija.maroh...@gmail.com> wrote:
> Is it possible to filter files from the static data source? My static folder
> is named "assets", I tried this:
> compile "/assets/*/" do
> puts item.identifier.chop
> case item[:extension]
> when 'scss'
> if File.basename(item.identifier) == "app.scss"
> filter :sass, sass_options
> filter :relativize_paths, type: :css
> end
> when "coffee"
> filter :coffeescript
> end
> end
> but when I try to compile, an error is raised:
> Nanoc::Errors::CannotUseTextualFilter: The “Nanoc::Filters::Sass” filter
> cannot be used to filter the “/assets/stylesheets/app.scss/” item (rep
> “default”), because textual filters cannot be used on binary items.
> Any idea why nanoc considers app.scss as a binary file?
> On Wednesday, July 11, 2012 5:02:37 AM UTC+2, Nathanael Phillips wrote:
>> Perfect, thanks! The prefix option worked like a charm :)
>> Thanks for the tip, and pointing out the power of the data-source and
>> other subfunctions!
>> On Monday, July 9, 2012 9:18:22 PM UTC-7, Eric Sunshine wrote:
>>> One other point: Rules match from top to bottom (first to last). Make
>>> sure that the 'compile' and 'route' rules for your static assets
>>> appear in Rules file before the catch-all compile/route rules match
>>> wildcard '*' to ensure nanoc does not ignore your static asset rules.
>>> -- ES
>>> On Tue, Jul 10, 2012 at 12:15 AM, Eric Sunshine wrote:
>>> > The problem is that the static data-source assumes that the source
>>> > directory containing static assets is named "static". If you want to
>>> > use a source directory named "assets", then you need to configure the
>>> > data source as such:
>>> > Note the new 'prefix' key. Its value is relative to your top-level
>>> > project directory (hence no leading "/").
>>> > (On my own site, I use the default source name "static", so I neither
>>> > ran into the issue nor thought about it when I replied originally to
>>> > Andrew.)
>>> > -- ES
>>> > On Mon, Jul 9, 2012 at 11:40 PM, Nathanael Phillips wrote:
>>> >> Thanks for the quick response, Eric!
>>> >> the static configuration is under the data_sources key.
>>> >> from show-plugins:
>>> >> Data Sources:
>>> >> The main purpose is that they've built their site quite close to how
>>> >> I'm
>>> >> structuring mine, and it was a great way to learn nanoc. Now that I
>>> >> have
>>> >> some time with it under my belt, I'm wondering if I need to start from
>>> >> scratch....
>>> >> On Monday, July 9, 2012 2:56:33 PM UTC-7, Eric Sunshine wrote:
>>> >>> Hi Nathaniel,
>>> >>> Comments below...
>>> >>> On Sun, Jul 8, 2012 at 5:37 PM, Nathanael Phillips
>>> >>> wrote:
>>> >>> > * My folder structure has content and assets as siblings
>>> >>> > ("/nanoc/content"
>>> >>> > and "/nanoc/assets").
>>> >>> > * config.yaml is:
>>> >>> > -
>>> >>> > type: static
>>> >>> > items_root: /assets
>>> >>> It's not clear from this excerpt if this configuration information
>>> >>> resides under the 'data_sources' key. If not, that could be a
>>> >>> problem.
>>> >>> This looks a bit suspect. For the static data-source, item.identifier
>>> >>> already contains the file extension, so there is no need to add it
>>> >>> again. Moreover, this rule is flattening the source /assets hierarchy
>>> >>> into a single output /assets directory. Is this really intended?
>>> >>> Typically, you could get by with the following much simpler rule
>>> >>> which
>>> >>> retains the directory hierarchy:
>>> >>> route '/assets/*/' do
>>> >>> item.identifier.chop
>>> >>> end
>>> >>> > There are no compile errors, but at the same time, the assets don't
>>> >>> > appear
>>> >>> > in the output folder.
>>> >>> You could try examining the output of the nanoc subcommand
>>> >>> 'show-plugins' to see if your static data-source is even recognized.
>>> >>> If it is, subcommands 'show-data' and 'show-rules' might tell you
>>> >>> what
>>> >>> nanoc intends to do with the static items.
>>> >>> -- ES
>>> >> --
>>> >> You received this message because you are subscribed to the nanoc
>>> >> discusssion group.
>>> >> To post to this group, send email to na...@googlegroups.com
>>> >> To unsubscribe from this group, send email to
>>> >> nanoc+un...@googlegroups.com
>>> >> For more options, visit this group at
>>> >> http://groups.google.com/group/nanoc?hl=en
> --
> You received this message because you are subscribed to the nanoc
> discusssion group.
> To post to this group, send email to nanoc@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en
> You could reprogram the datasource to assign binary status
> dynamically. Alternately, a work-around would be to add a 'preprocess'
> block to your Rules file which assigns 'false' to the :binary
> attribute of each item with .scss extension.
> -- ES
> On Mon, Oct 29, 2012 at 7:57 PM, Matija Marohnić
> <matija.maroh...@gmail.com> wrote:
> > Is it possible to filter files from the static data source? My static
> folder
> > is named "assets", I tried this:
> > compile "/assets/*/" do
> > puts item.identifier.chop
> > case item[:extension]
> > when 'scss'
> > if File.basename(item.identifier) == "app.scss"
> > filter :sass, sass_options
> > filter :relativize_paths, type: :css
> > end
> > when "coffee"
> > filter :coffeescript
> > end
> > end
> > but when I try to compile, an error is raised:
> > Nanoc::Errors::CannotUseTextualFilter: The “Nanoc::Filters::Sass” filter
> > cannot be used to filter the “/assets/stylesheets/app.scss/” item (rep
> > “default”), because textual filters cannot be used on binary items.
> > Any idea why nanoc considers app.scss as a binary file?
> > On Wednesday, July 11, 2012 5:02:37 AM UTC+2, Nathanael Phillips wrote:
> >> Perfect, thanks! The prefix option worked like a charm :)
> >> Thanks for the tip, and pointing out the power of the data-source and
> >> other subfunctions!
> >> On Monday, July 9, 2012 9:18:22 PM UTC-7, Eric Sunshine wrote:
> >>> One other point: Rules match from top to bottom (first to last). Make
> >>> sure that the 'compile' and 'route' rules for your static assets
> >>> appear in Rules file before the catch-all compile/route rules match
> >>> wildcard '*' to ensure nanoc does not ignore your static asset rules.
> >>> -- ES
> >>> On Tue, Jul 10, 2012 at 12:15 AM, Eric Sunshine wrote:
> >>> > The problem is that the static data-source assumes that the source
> >>> > directory containing static assets is named "static". If you want to
> >>> > use a source directory named "assets", then you need to configure the
> >>> > data source as such:
> >>> > Note the new 'prefix' key. Its value is relative to your top-level
> >>> > project directory (hence no leading "/").
> >>> > (On my own site, I use the default source name "static", so I neither
> >>> > ran into the issue nor thought about it when I replied originally to
> >>> > Andrew.)
> >>> > -- ES
> >>> > On Mon, Jul 9, 2012 at 11:40 PM, Nathanael Phillips wrote:
> >>> >> Thanks for the quick response, Eric!
> >>> >> the static configuration is under the data_sources key.
> >>> >> from show-plugins:
> >>> >> Data Sources:
> >>> >> I changed the routing item, too -- I'm building this off of another
> >>> >> template, which is why I used that odd line; it's what they did ;)
> >>> >> Nothing for assets shows up in show-data or show-rules, though. Any
> >>> >> thoughts?
> >>> >> The main purpose is that they've built their site quite close to how
> >>> >> I'm
> >>> >> structuring mine, and it was a great way to learn nanoc. Now that I
> >>> >> have
> >>> >> some time with it under my belt, I'm wondering if I need to start
> from
> >>> >> scratch....
> >>> >> On Monday, July 9, 2012 2:56:33 PM UTC-7, Eric Sunshine wrote:
> >>> >>> Hi Nathaniel,
> >>> >>> Comments below...
> >>> >>> On Sun, Jul 8, 2012 at 5:37 PM, Nathanael Phillips
> >>> >>> wrote:
> >>> >>> > * My folder structure has content and assets as siblings
> >>> >>> > ("/nanoc/content"
> >>> >>> > and "/nanoc/assets").
> >>> >>> > * config.yaml is:
> >>> >>> > -
> >>> >>> > type: static
> >>> >>> > items_root: /assets
> >>> >>> It's not clear from this excerpt if this configuration information
> >>> >>> resides under the 'data_sources' key. If not, that could be a
> >>> >>> problem.
> >>> >>> This looks a bit suspect. For the static data-source,
> item.identifier
> >>> >>> already contains the file extension, so there is no need to add it
> >>> >>> again. Moreover, this rule is flattening the source /assets
> hierarchy
> >>> >>> into a single output /assets directory. Is this really intended?
> >>> >>> Typically, you could get by with the following much simpler rule
> >>> >>> which
> >>> >>> retains the directory hierarchy:
> >>> >>> route '/assets/*/' do
> >>> >>> item.identifier.chop
> >>> >>> end
> >>> >>> > There are no compile errors, but at the same time, the assets
> don't
> >>> >>> > appear
> >>> >>> > in the output folder.
> >>> >>> You could try examining the output of the nanoc subcommand
> >>> >>> 'show-plugins' to see if your static data-source is even
> recognized.
> >>> >>> If it is, subcommands 'show-data' and 'show-rules' might tell you
> >>> >>> what
> >>> >>> nanoc intends to do with the static items.
> >>> >>> -- ES
> >>> >> --
> >>> >> You received this message because you are subscribed to the nanoc
> >>> >> discusssion group.
> >>> >> To post to this group, send email to na...@googlegroups.com
> >>> >> To unsubscribe from this group, send email to
> >>> >> nanoc+un...@googlegroups.com
> >>> >> For more options, visit this group at
> >>> >> http://groups.google.com/group/nanoc?hl=en
> > --
> > You received this message because you are subscribed to the nanoc
> > discusssion group.
> > To post to this group, send email to nanoc@googlegroups.com
> > To unsubscribe from this group, send email to
> > nanoc+unsubscribe@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/nanoc?hl=en
> --
> You received this message because you are subscribed to the nanoc
> discusssion group.
> To post to this group, send email to nanoc@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en
Have you verified that the :binary attribute actually has been set to
'false'? (Print out the item ID and :binary attribute for each matched
item in 'preprocess' and/or the static data source.) Did you clear the
nanoc cache? (The cache should have been recognized as out-of-date
automatically, but, if not, you might try deleting the 'tmp' and
'output' folders manually.)
>> You could reprogram the datasource to assign binary status
>> dynamically. Alternately, a work-around would be to add a 'preprocess'
>> block to your Rules file which assigns 'false' to the :binary
>> attribute of each item with .scss extension.
>> -- ES
>> On Mon, Oct 29, 2012 at 7:57 PM, Matija Marohnić
>> <matija.maroh...@gmail.com> wrote:
>> > Is it possible to filter files from the static data source? My static
>> > folder
>> > is named "assets", I tried this:
>> > compile "/assets/*/" do
>> > puts item.identifier.chop
>> > case item[:extension]
>> > when 'scss'
>> > if File.basename(item.identifier) == "app.scss"
>> > filter :sass, sass_options
>> > filter :relativize_paths, type: :css
>> > end
>> > when "coffee"
>> > filter :coffeescript
>> > end
>> > end
>> > but when I try to compile, an error is raised:
>> > Nanoc::Errors::CannotUseTextualFilter: The “Nanoc::Filters::Sass” filter
>> > cannot be used to filter the “/assets/stylesheets/app.scss/” item (rep
>> > “default”), because textual filters cannot be used on binary items.
>> > Any idea why nanoc considers app.scss as a binary file?
>> > On Wednesday, July 11, 2012 5:02:37 AM UTC+2, Nathanael Phillips wrote:
>> >> Perfect, thanks! The prefix option worked like a charm :)
>> >> Thanks for the tip, and pointing out the power of the data-source and
>> >> other subfunctions!
>> >> On Monday, July 9, 2012 9:18:22 PM UTC-7, Eric Sunshine wrote:
>> >>> One other point: Rules match from top to bottom (first to last). Make
>> >>> sure that the 'compile' and 'route' rules for your static assets
>> >>> appear in Rules file before the catch-all compile/route rules match
>> >>> wildcard '*' to ensure nanoc does not ignore your static asset rules.
>> >>> -- ES
>> >>> On Tue, Jul 10, 2012 at 12:15 AM, Eric Sunshine wrote:
>> >>> > The problem is that the static data-source assumes that the source
>> >>> > directory containing static assets is named "static". If you want to
>> >>> > use a source directory named "assets", then you need to configure
>> >>> > the
>> >>> > data source as such:
>> >>> > Note the new 'prefix' key. Its value is relative to your top-level
>> >>> > project directory (hence no leading "/").
>> >>> > (On my own site, I use the default source name "static", so I
>> >>> > neither
>> >>> > ran into the issue nor thought about it when I replied originally to
>> >>> > Andrew.)
>> >>> > -- ES
>> >>> > On Mon, Jul 9, 2012 at 11:40 PM, Nathanael Phillips wrote:
>> >>> >> Thanks for the quick response, Eric!
>> >>> >> the static configuration is under the data_sources key.
>> >>> >> from show-plugins:
>> >>> >> Data Sources:
>> >>> >> I changed the routing item, too -- I'm building this off of another
>> >>> >> template, which is why I used that odd line; it's what they did ;)
>> >>> >> Nothing for assets shows up in show-data or show-rules, though.
>> >>> >> Any
>> >>> >> thoughts?
>> >>> >> The main purpose is that they've built their site quite close to
>> >>> >> how
>> >>> >> I'm
>> >>> >> structuring mine, and it was a great way to learn nanoc. Now that I
>> >>> >> have
>> >>> >> some time with it under my belt, I'm wondering if I need to start
>> >>> >> from
>> >>> >> scratch....
>> >>> >> On Monday, July 9, 2012 2:56:33 PM UTC-7, Eric Sunshine wrote:
>> >>> >>> Hi Nathaniel,
>> >>> >>> Comments below...
>> >>> >>> On Sun, Jul 8, 2012 at 5:37 PM, Nathanael Phillips
>> >>> >>> wrote:
>> >>> >>> > * My folder structure has content and assets as siblings
>> >>> >>> > ("/nanoc/content"
>> >>> >>> > and "/nanoc/assets").
>> >>> >>> > * config.yaml is:
>> >>> >>> > -
>> >>> >>> > type: static
>> >>> >>> > items_root: /assets
>> >>> >>> It's not clear from this excerpt if this configuration information
>> >>> >>> resides under the 'data_sources' key. If not, that could be a
>> >>> >>> problem.
>> >>> >>> This looks a bit suspect. For the static data-source,
>> >>> >>> item.identifier
>> >>> >>> already contains the file extension, so there is no need to add it
>> >>> >>> again. Moreover, this rule is flattening the source /assets
>> >>> >>> hierarchy
>> >>> >>> into a single output /assets directory. Is this really intended?
>> >>> >>> Typically, you could get by with the following much simpler rule
>> >>> >>> which
>> >>> >>> retains the directory hierarchy:
>> >>> >>> route '/assets/*/' do
>> >>> >>> item.identifier.chop
>> >>> >>> end
>> >>> >>> > There are no compile errors, but at the same time, the assets
>> >>> >>> > don't
>> >>> >>> > appear
>> >>> >>> > in the output folder.
>> >>> >>> You could try examining the output of the nanoc subcommand
>> >>> >>> 'show-plugins' to see if your static data-source is even
>> >>> >>> recognized.
>> >>> >>> If it is, subcommands 'show-data' and 'show-rules' might tell you
>> >>> >>> what
>> >>> >>> nanoc intends to do with the static items.
>> >>> >>> -- ES
>> >>> >> --
>> >>> >> You received this message because you are subscribed to the nanoc
>> >>> >> discusssion group.
>> >>> >> To post to this group, send email to na...@googlegroups.com
>> >>> >> To unsubscribe from this group, send email to
>> >>> >> nanoc+un...@googlegroups.com
>> >>> >> For more options, visit this group at
>> >>> >> http://groups.google.com/group/nanoc?hl=en
>> > --
>> > You received this message because you are subscribed to the nanoc
>> > discusssion group.
>> > To post to this group, send email to nanoc@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > nanoc+unsubscribe@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/nanoc?hl=en
>> --
>> You received this message because you are subscribed to the nanoc
>> discusssion group.
>> To post to this group, send email to nanoc@googlegroups.com
>> To unsubscribe from this group, send email to
>> nanoc+unsubscribe@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/nanoc?hl=en
> --
> You received this message because you are subscribed to the nanoc
> discusssion group.
> To post to this group, send email to nanoc@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en
On 30 Oct 2012, at 00:57, Matija Marohnić <matija.maroh...@gmail.com> wrote:
> Is it possible to filter files from the static data source?
The static data source’s intention is to be used in case you want to pass-through files and simply copy them to output/ without filtering them. I recommend that you move your CSS/SCSS/… files that you want to filter into content/assets/ instead.
Deleting the contents of tmp also didn't work. Ok, I guess I'll move them
to content/assets, I just wanted to have content/index.haml and
content/assets/stylesheets/index.scss file without having to prefix
stylesheets with an underscore.
denis.defre...@stoneship.org> wrote:
> On 30 Oct 2012, at 00:57, Matija Marohnić <matija.maroh...@gmail.com>
> wrote:
> > Is it possible to filter files from the static data source?
> The static data source’s intention is to be used in case you want to
> pass-through files and simply copy them to output/ without filtering them.
> I recommend that you move your CSS/SCSS/… files that you want to filter
> into content/assets/ instead.
> Cheers
> Denis
> --
> You received this message because you are subscribed to the nanoc
> discusssion group.
> To post to this group, send email to nanoc@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en
On Tuesday, October 30, 2012 3:39:37 AM UTC+1, Eric Sunshine wrote:
> Have you verified that the :binary attribute actually has been set to > 'false'? (Print out the item ID and :binary attribute for each matched > item in 'preprocess' and/or the static data source.) Did you clear the > nanoc cache? (The cache should have been recognized as out-of-date > automatically, but, if not, you might try deleting the 'tmp' and > 'output' folders manually.)
> -- ES
> On Mon, Oct 29, 2012 at 9:11 PM, Matija Marohnić > <matija....@gmail.com <javascript:>> wrote: > > I tried doing both. First I tried:
> > preprocess do > > items.each do |item| > > if /scss|coffee/.match(item[:extension]) > > item[:binary] = false > > end > > end > > end
> > but the error remained. Then I modified a part of static.rb:
> >> You could reprogram the datasource to assign binary status > >> dynamically. Alternately, a work-around would be to add a 'preprocess' > >> block to your Rules file which assigns 'false' to the :binary > >> attribute of each item with .scss extension.
> >> -- ES
> >> On Mon, Oct 29, 2012 at 7:57 PM, Matija Marohnić > >> <matija....@gmail.com <javascript:>> wrote: > >> > Is it possible to filter files from the static data source? My static > >> > folder > >> > is named "assets", I tried this:
> >> > compile "/assets/*/" do > >> > puts item.identifier.chop > >> > case item[:extension] > >> > when 'scss' > >> > if File.basename(item.identifier) == "app.scss" > >> > filter :sass, sass_options > >> > filter :relativize_paths, type: :css > >> > end > >> > when "coffee" > >> > filter :coffeescript > >> > end > >> > end
> >> > but when I try to compile, an error is raised:
> >> > Nanoc::Errors::CannotUseTextualFilter: The “Nanoc::Filters::Sass” > filter > >> > cannot be used to filter the “/assets/stylesheets/app.scss/” item > (rep > >> > “default”), because textual filters cannot be used on binary items.
> >> > Any idea why nanoc considers app.scss as a binary file?
> >> > On Wednesday, July 11, 2012 5:02:37 AM UTC+2, Nathanael Phillips > wrote:
> >> >> Perfect, thanks! The prefix option worked like a charm :)
> >> >> Thanks for the tip, and pointing out the power of the data-source > and > >> >> other subfunctions!
> >> >> On Monday, July 9, 2012 9:18:22 PM UTC-7, Eric Sunshine wrote:
> >> >>> One other point: Rules match from top to bottom (first to last). > Make > >> >>> sure that the 'compile' and 'route' rules for your static assets > >> >>> appear in Rules file before the catch-all compile/route rules match > >> >>> wildcard '*' to ensure nanoc does not ignore your static asset > rules.
> >> >>> -- ES
> >> >>> On Tue, Jul 10, 2012 at 12:15 AM, Eric Sunshine wrote: > >> >>> > The problem is that the static data-source assumes that the > source > >> >>> > directory containing static assets is named "static". If you want > to > >> >>> > use a source directory named "assets", then you need to configure > >> >>> > the > >> >>> > data source as such:
> >> >>> > Note the new 'prefix' key. Its value is relative to your > top-level > >> >>> > project directory (hence no leading "/").
> >> >>> > (On my own site, I use the default source name "static", so I > >> >>> > neither > >> >>> > ran into the issue nor thought about it when I replied originally > to > >> >>> > Andrew.)
> >> >>> > -- ES
> >> >>> > On Mon, Jul 9, 2012 at 11:40 PM, Nathanael Phillips wrote: > >> >>> >> Thanks for the quick response, Eric!
> >> >>> >> the static configuration is under the data_sources key. > >> >>> >> from show-plugins: > >> >>> >> Data Sources:
> >> >>> >> I changed the routing item, too -- I'm building this off of > another > >> >>> >> template, which is why I used that odd line; it's what they did > ;)
> >> >>> >> Nothing for assets shows up in show-data or show-rules, though. > >> >>> >> Any > >> >>> >> thoughts?
> >> >>> >> The main purpose is that they've built their site quite close to > >> >>> >> how > >> >>> >> I'm > >> >>> >> structuring mine, and it was a great way to learn nanoc. Now > that I > >> >>> >> have > >> >>> >> some time with it under my belt, I'm wondering if I need to > start > >> >>> >> from > >> >>> >> scratch....
> >> >>> >> On Monday, July 9, 2012 2:56:33 PM UTC-7, Eric Sunshine wrote:
> >> >>> >>> Hi Nathaniel,
> >> >>> >>> Comments below...
> >> >>> >>> On Sun, Jul 8, 2012 at 5:37 PM, Nathanael Phillips > >> >>> >>> wrote: > >> >>> >>> > * My folder structure has content and assets as siblings > >> >>> >>> > ("/nanoc/content" > >> >>> >>> > and "/nanoc/assets"). > >> >>> >>> > * config.yaml is: > >> >>> >>> > - > >> >>> >>> > type: static > >> >>> >>> > items_root: /assets
> >> >>> >>> It's not clear from this excerpt if this configuration > information > >> >>> >>> resides under the 'data_sources' key. If not, that could be a > >> >>> >>> problem.
> >> >>> >>> This looks a bit suspect. For the static data-source, > >> >>> >>> item.identifier > >> >>> >>> already contains the file extension, so there is no need to add > it > >> >>> >>> again. Moreover, this rule is flattening the source /assets > >> >>> >>> hierarchy > >> >>> >>> into a single output /assets directory. Is this really > intended? > >> >>> >>> Typically, you could get by with the following much simpler > rule > >> >>> >>> which > >> >>> >>> retains the directory hierarchy:
> >> >>> >>> route '/assets/*/' do > >> >>> >>> item.identifier.chop > >> >>> >>> end
> >> >>> >>> > There are no compile errors, but at the same time, the assets > >> >>> >>> > don't > >> >>> >>> > appear > >> >>> >>> > in the output folder.
> >> >>> >>> You could try examining the output of the nanoc subcommand > >> >>> >>> 'show-plugins' to see if your static data-source is even > >> >>> >>> recognized. > >> >>> >>> If it is, subcommands 'show-data' and 'show-rules' might tell > you > >> >>> >>> what > >> >>> >>> nanoc intends to do with the static items.
> >> >>> >>> -- ES
> >> >>> >> -- > >> >>> >> You received this message because you are subscribed to the > nanoc > >> >>> >> discusssion group.
> >> >>> >> To post to this group, send email to na...@googlegroups.com > >> >>> >> To unsubscribe from this group, send email to > >> >>> >> nanoc+un...@googlegroups.com > >> >>> >> For more options, visit this group at > >> >>> >> http://groups.google.com/group/nanoc?hl=en
> >> > -- > >> > You received this message because you are subscribed to the nanoc > >> > discusssion group.
> >> > To post to this group, send email to na...@googlegroups.com<javascript:> > >> > To unsubscribe from this group, send email to > >> > nanoc+un...@googlegroups.com <javascript:> > >> > For more options, visit this group at > >> > http://groups.google.com/group/nanoc?hl=en
> >> -- > >> You received this message because you are subscribed to the nanoc
many posts seem to try over-complex code as a way of solving issues... but
as Denis wrote:
The static data source’s intention is to be used in case you want to
> pass-through files and simply copy them to output/ without filtering them. > I recommend that you move your CSS/SCSS/… files that you want to filter > into content/assets/ instead.
which is exactly what I did on first using Nanoc :-)