MishkaCmsCore.Runtime.Resources.Changes.StylesheetCompiles (Mishka CMS Core v0.0.5-alpha.5)

Copy Markdown View Source

Refuses a stylesheet whose CSS Tailwind will not build, on its content field, in Tailwind's own words: MishkaCmsCore.Runtime.Compilers.TailwindCompiler.verify_css/2, the check the builder's reusable classes are written through.

Every row is pasted into the input Tailwind builds a site's CSS from, so one row it refuses (an unclosed {, an @apply of a utility it does not know) fails that whole build, and the site keeps the CSS it had before for every later change too. The save said it was updated.

Asked when content changes, in a before_transaction hook: it runs the Tailwind binary, about 1.5 s, so it waits for the write rather than running on a form's every keystroke, and it is done before the write's transaction opens, so no database connection is held while Tailwind runs. The builder's own rows (page_code: :builder) are left to the builder, which checks each class and each element's CSS before it writes the row.

changes do
  change {MishkaCmsCore.Runtime.Resources.Changes.StylesheetCompiles, []},
    on: [:create, :update]
end