antwarjs / antwar

A static site generator built with React and Webpack.
https://antwar.js.org/
MIT License
460 stars 35 forks source link

Allow for posts and pages to include scripts #6

Closed eldh closed 9 years ago

eldh commented 9 years ago

There's currently no nice way to create dynamic pages (that include scripts in some form). This needs to be fixed, naturally.

I don't know which is the best approach, but generating entrypoints for webpack is an idea worth investigating.

bebraw commented 9 years ago

Maybe we have been thinking this the wrong way. If you want to include scripts to some specific page or post, you'll probably want to author it in jsx or some variant anyway (yaml headmatter included). In that case require can deal with the problem for us (I think the current resolve path configuration might be enough). We just need to make sure the core can deal with components like this. This would sound like a good starting point to me.

The potential problem here is that writing the actual post would get a little harder but I have a feeling loaders could help here too.

In short we can probably make this Webpack's problem, not ours.

eldh commented 9 years ago

We can include scripts using dangerouslySetInnerHTML already (it's done in default-theme Body). And we can also reference script files in assets.

We also want the isomorphic react bit to work though. For example to allow search components to be written in pure react.

eldh commented 9 years ago

Maybe close this and open another issue for the isomorphic stuff though.

eldh commented 9 years ago

Closing. There's #16 for the isomorphic bit.