Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing item in preprocessor does not update dependencies #1554

Closed
denisdefreyne opened this issue Oct 9, 2021 · 0 comments · Fixed by #1555
Closed

Removing item in preprocessor does not update dependencies #1554

denisdefreyne opened this issue Oct 9, 2021 · 0 comments · Fixed by #1555

Comments

@denisdefreyne
Copy link
Member

Steps to reproduce

Use the following setup, where one main item includes all parts:

    FileUtils.mkdir_p('content')
    FileUtils.mkdir_p('content/parts')

    File.write('content/main.erb', 'Stuff')
    File.write('content/parts/a.txt', "---\ndraft: false\n---\nPart A")
    File.write('content/parts/b.txt', "---\ndraft: false\n---\nPart B")

    File.write('Rules', <<~CONTENT)
      preprocess do
        @items.delete_if { |i| i[:draft] }
      end

      compile '/*.erb' do
        filter :erb
        write ext: 'txt'
      end

      compile '/**/*.txt' do
        write ext: 'txt'
      end
    CONTENT

    File.write('content/main.erb', '<%= @items.find_all("/parts/*").map(&:compiled_content).sort.join("\n") %>')

Compile. output/main.txt will contain both parts A and B.

Mark a part as draft:

    File.write('content/parts/b.txt', "---\ndraft: true\n---\nPart B")

Compile.

Expected behavior

output/main.txt will contain only part A.

Actual behavior

output/main.txt will contain both parts A and B.

Details

Crash log

n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant