harp icon indicating copy to clipboard operation
harp copied to clipboard

partial() should work with any preprocessor

Open kennethormandy opened this issue 10 years ago • 5 comments

Expected Behaviour

Inside templating languages, partial() can inline any preprocessed file, like so:

style(type="text/css")=partial("css/" + current.source)

Actual Behaviour

This is only possible with other templating languages plus Markdown.

div=partial("template/" + current.source)

kennethormandy avatar Oct 04 '13 02:10 kennethormandy

Makes sense.

sintaxi avatar Oct 10 '13 10:10 sintaxi

Is there any update on this? I would like to be able to render my less files as an inline style block in order to validate against Google's accelerated mobile pages (which doesn't support linked stylesheets.)

Another option is to make the jade-filter mixin available (or upgrade to PugJS which has a built-in filter feature).

anthony-arnold avatar Nov 21 '16 05:11 anthony-arnold

I modified my forks of harp/terraform to support partial LESS files. It works fine for my usage but it breaks some tests and I won't support it, so your mileage may vary.

Diff: https://github.com/sintaxi/terraform/compare/master...justindujardin:master

Install:

npm i --save git+https://github.com/justindujardin/harp.git

Use:

<head>
  ...
  <%- partial("./_coolstyles.less") %>
</head>
    

justindujardin avatar Jun 17 '17 17:06 justindujardin

Nice job. I can imagine this wasn't easy to get working. Lots of edge cases.

sintaxi avatar Jun 17 '17 23:06 sintaxi

@sintaxi any chance to get this feature merged into master? I am also looking forward to include preprocessed scss into jade.

breytex avatar Aug 14 '18 12:08 breytex