Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

11
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

middlemanでbuild後に何か処理を行いたい

Last updated at Posted at 2014-03-20

訳あってビルド後に/build/nantoka/を消す必要がありました。
extentionを使用する方法もあるようですが、
検索したところ上記を解決する方法が別にあったので紹介。

##方法

config.rbのconfigure :build doの中にafter_build doを追加し、
systemで実行したいコマンドを書く。
コマンドが実行される場所はプロジェクトのルートになるようです。

config.rb
configure :build do
  after_build do
    system 'rm -d build/nantoka/'
    system 'echo hoge'
    system './hoge.sh'
  end
end

参考になったやりとり:
http://forum.middlemanapp.com/t/execute-ruby-file-after-build/1170/4

##あとでわかったこと
単にnantokaディレクトリをbuild内に残したくないだけであれば、
configure :build do 内にignoreでフォルダを指定するほうがシンプルですね。

config.rb
configure :build do
  ignore 'nantoka/*'
end

参考になったやりとり:
http://forum.middlemanapp.com/t/ignore-folder-when-build/1162/4

11
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
11
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?