winton / stasis

Static sites made powerful
http://stasis.me
MIT License
679 stars 56 forks source link

After plugin #84

Closed harold closed 6 years ago

harold commented 11 years ago

I made a simplest-possible 'After' plugin.

It exposes an after method in controllers so you can run some code after everything's generated.

It let me write this in my controller.rb, which brought joy:

after do
    File.open( "./public/sitemap.txt", "w" ) do |f|
        Dir["public/**/*.html"].each do |n|
            f.puts "http://danceliquid.com/#{n}"
        end
    end
end

Take it, if you'd like. (:

alem0lars commented 11 years ago

It would be great to have this :+1:

alexdean commented 10 years ago

@harold I think you need to load the plugin also.

https://github.com/alexdean/stasis/commit/79bcfba20052903ad604923a3f26d91d9330a027

harold commented 10 years ago

@alexdean (!) Too right, friend!

emot-psyduck

I have a very similar edit in my local stasis.rb ... I must have flubbed the git add on the original commit.

Artfully done, sir.

alexdean commented 10 years ago

@harold :v:

winton commented 10 years ago

Hey @harold, sorry for the late reply on this. Could you add @alexdean's change to your PR?

I generally don't merge without specs but I could write some up for this. Thanks.

harold commented 10 years ago

@winton, no problem on the late reply. Thanks for stasis, I enjoy it thoroughly.

I added the require line at the beginning to keep them in alphabetical order. (not because my plugin is the most important) :dizzy_face:

I briefly wondered about how you were doing the specs. I'll have a look at what you do so I'll know what to do if I contribute more in the future.

Take care, friend.

jedemenge-it commented 10 years ago

Hi,

why is this feature not merged? It would be nice to have it by default (without tweaking the local installation).

Cheers