## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• Dec 06 18:47
da2x commented #1453
• Dec 06 18:42
da2x commented #243
• Dec 06 07:12
ddfreyne commented #243
• Dec 06 07:08
da2x closed #243
• Dec 06 07:08
da2x commented #243
• Dec 06 07:03

ddfreyne on master

Update binary to text filter ty… Merge pull request #242 from da… (compare)

• Dec 06 07:03
ddfreyne closed #242
• Dec 06 07:03
ddfreyne commented #242
• Dec 06 07:00
da2x commented #243
• Dec 06 07:00
da2x opened #243
• Dec 06 05:58
da2x opened #242
• Dec 02 15:14
blinry commented #1470
• Dec 01 12:53

ddfreyne on extract-nanoc-sass

Extract nanoc-sass gem (compare)

• Dec 01 12:23

ddfreyne on master

• Dec 01 12:14

ddfreyne on master

• Dec 01 11:24

ddfreyne on master

nanoc-live: Depend on nanoc-{co… (compare)

• Dec 01 10:52
ddfreyne commented #1470
• Dec 01 10:36
ddfreyne labeled #1473
• Dec 01 10:36
ddfreyne commented #1473
• Dec 01 10:24
ddfreyne closed #1472
Denis Defreyne
@ddfreyne
I think that sounds sensible
One of the ideas I was working on a while ago was building an API for querying, so you’d also have stuff like @items.find_by_attr(title: 'blah')
(which would be faster than with #select)
Gregory Pakosz
@gpakosz
is raw_filename an attribute?
Denis Defreyne
@ddfreyne
It’s not a Nanoc attribute. You access it using item.raw_filename rather than item[:raw_filename]
Denis Defreyne
@ddfreyne
@da2x I’ve not been able to reproduce nanoc/nanoc#1453 yet — can you double-check?
Gregory Pakosz
@gpakosz
@ddfreyne do you have time to chat a bit about the Nanoc filter pipeline?
@ddfreyne I'm exploring writing a :sprockets filter. For .js files, but in fact I believe I can use it with .scss as well
@ddfreyne In a way, it's going to be similar to what I did for :scss and :scss_sourcemap. What I will try to achieve with sprockets is //= require /some/nanoc/item/identifier.*
@ddfreyne this approach delegates everything to :sprockets and :sprockets_sourcemap
@ddfreyne often, I feel like that I have needs for the following: :filter1 leaves a trail for later filters
@ddfreyne the thing is, there's no practical way to let a filter "tag" items with custom information
@ddfreyne could Nanoc allow this?
Denis Defreyne
@ddfreyne
I like the idea. I’ll write up something in the nanoc/features repository
Gregory Pakosz
@gpakosz
filters could even leave trails for layout passes
like "I've been filtered with the :mathjax filter" which would make the "wrapping layout" inject proper css stylesheet links
even the mere list of filter names that have been applied would enable interesting features
@item#filter() would return [:filter1, :filter2, ...] and the list would augment the more filtering passes have been applied
Denis Defreyne
@ddfreyne
Denis Defreyne
@ddfreyne
Gregory Pakosz
@gpakosz
to the very same issue?
Gregory Pakosz
@gpakosz
@ddfreyne what's the rationale behind https://nanoc.ws/doc/helpers/#writing-helpers somewhat telling helpers should be placed in modules while it's not the case for filters? https://nanoc.ws/doc/filters/#writing-filters
Gregory Pakosz
@gpakosz
@ddfreyne another question: what's nanoc-live compared to guard-nanoc?
Denis Defreyne
@ddfreyne

somewhat telling helpers should be placed in modules

Helpers are modules… you activate them by using include or use_helper

what's nanoc-live compared to guard-nanoc?

nanoc-live will replace guard-nano eventually

Gregory Pakosz
@gpakosz
in erb.rb, what's the purpose of the following lines?
# Add locals
assigns.merge!(params[:locals] || {})
Gregory Pakosz
@gpakosz
in fact I don't understand most of the filter impl 😐
      # Create context
context = ::Nanoc::Core::Context.new(assigns)

# Get binding
proc = assigns[:content] ? -> { assigns[:content] } : nil
assigns_binding = context.get_binding(&proc)
Denis Defreyne
@ddfreyne

The Add locals bit is so that you can do

filter :erb, locals: { foo: 'bar' }

and then, inside the erb template, @foo would be set to 'bar'

Bindings and context is… confusing for sure, heh. ERB is evaluated inside a context, where you have both stuff like @item and item available. A Context has both those instance variables (so you can do @item), as well as methods #item (so you can do item).

This bit

assigns[:content] ? -> { assigns[:content] } : nil

says that, if there is a :content available (i.e. you’re layouting), then create a proc -> { assigns[:content] } — that proc yields the content. This makes it possible to say <%= yield %> — you’re essentially calling that proc

Finally, the get_binding thing allows the ERB template to be evaluated inside that context
Gregory Pakosz
@gpakosz
interesting
I'm wondering, when using ERB, is it possible know at which line of the input content (the one with <%= ... %> syntax lives in) we are?
In other words, with a broader statement, could I derive sourcemap info from ERB processing?
Denis Defreyne
@ddfreyne
Not as far as I know
Gregory Pakosz
@gpakosz
@ddfreyne hello. What do you think of providing a way to query itemrep → [:filter1, :filter2, ...]. Would that be possible? Same for layouts
Denis Defreyne
@ddfreyne
@gpakosz You mean something like @item_rep.all_filters which returns the list of filters that are applied to this item rep?
That is doable I think.
Gregory Pakosz
@gpakosz
yep
also I commented on nanoc/features#55
Denis Defreyne
@ddfreyne
I saw!
Denis Defreyne
@ddfreyne
I will prob be more busy than usual the next few weeks, as I’m moving apartments
Gregory Pakosz
@gpakosz
that's good news!
Daniel Aleksandersen
@da2x
@ddfreyne I saw your msg. from nov-16 now. I can’t reproduce it on demand either. I keep thinking that I’ve narrowed it down and then it slips away from me again.
@ddfreyne I spent two hours the other day trying to figure out why changes to one of my layout files stopped being tracked. it has happen a couple of times before. I change a layout, compile., and save another change to the file before the compilation is done. sometimes that puts that one layout file in a weird state. no matter how many changes I make to that layout file the changes won’t get compiled in. I must either move the offending layout file out of the way, run compile, let it fail, and then move it back; OR delete the tmp/cache/. It’s the same thing I’ve done every time this has happen. Editing a layout while nanoc is compiling. But I can’t reproduce it on demand.
Denis Defreyne
@ddfreyne
@da2x Is this on a web site that I could get access to?
The source code, that is