3

Are there any recommended workflows for managing front-end dependencies? I've been reading a lot of articles that recommend moving away from Bower, and on to an npm-only solution like Webpack, but Webpack is a whole new paradigm (loading js, scss, fonts, etc through a single js file) that by default, requires js to be running in the browser for css to load. Part of the reason I want a static site is so that js isn't mandatory for an end-user. However, I'm really tired of bower-installing things, and then having to either host everything in bower_components, targeting specific filenames (js, css, img) to include in output, or move their css/img dependencies into my own repo. Not to mention that relying on two registries is less than ideal.

Does Hexo have a recommended way, or does anyone have an opinion on how to do this? Running a Hexo server in a separate terminal from a webpack-dev-server seems painful and awkward, and possibly create some confusion as to which library should be handling which files.

Are other tools more suited for dependency management in a static site generator's dev/build process?

KFunk
  • 2,956
  • 22
  • 33
  • 1
    Browserify and webpack are popular solely for their paradigm. If you want to use bower, there's nothing stopping you, but when you look at a larger project you start to really benefit from the paradigm of Browserify or Webpack, simply because you have control over what modules can interact with each other rather than just loading them all into the webpage haphazardly. Also most of production environments are going to bundle/minify all the JS into a single file to reduce load time and overhead of having multiple http request to pull JS to the client. – tsturzl Jul 23 '16 at 00:23
  • 1
    If you're just using Hexo for a blog then you can use bower if that's easiest because you may never reach a level of complexity where something like browserify or webpack really become extremely useful. As far as hexo goes the paradigm is generally to just have the logic taken care of at the time of generating the static pages. I host a blog using hexo and there is very little JS on my pages, mainly just to add a comments section and things of that nature. There is no recommended way, its really up to the template designer to figure out what is more beneficial. – tsturzl Jul 23 '16 at 00:26
  • I'm actually looking at Hexo to build a ~200 Page site + ~50 blog Posts on top of that + one of the pages that functions as a single-page-app currently has ~100 js files that are min/concatted by usemin. I guess I'm mostly looking for an example where they are used together, since both Hexo and Webpack have means of loading/rendering/filtering/copying assets. – KFunk Jul 23 '16 at 01:15

0 Answers0