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

Any recommended gulpfile or gruntfile or any other tool to optimize before deploying? #43

Open
JazzTp opened this issue Aug 29, 2015 · 6 comments

Comments

@JazzTp
Copy link

JazzTp commented Aug 29, 2015

Hi, I've been looking for a _gulpfile_ or _gruntfile_ or any other easy to use tool to successfully optimize before deploying.

I ran into some build errors which, I read on the web, are actually related with font-awesome (or with certain versions of it) and other specific resources in use (or optionally in use) in Hyde-X.

Is anybody successfully optimizing, with which tool(s)?

I'd like it all if possible :) fetch remote resources, minify and concat of css, js and html.

@JazzTp
Copy link
Author

JazzTp commented Aug 29, 2015

Well, I have been seeing "a lot" this error and researching how to get rid of it:

events.js:85
      throw er; // Unhandled 'error' event

Apparently it is being associated with very different possible causes in different scenarios.

font-awesome version:
mcasimir/generator-mobileangularui#8

port number being served, other node process running, user permissions:
http://stackoverflow.com/questions/16827987/expressjs-throw-er-unhandled-error-event

node/gulp/components version:
google/web-starter-kit#678

specific code of some call in an application
http://stackoverflow.com/questions/31789502/google-api-exception-unhandled-by-user-code-request-error

a syntax error in one of the included minified files
http://stackoverflow.com/questions/31003457/gulp-uglify-events-js-unhandled-error-event

(EDIT: checking if it is fetching remote resources what triggers this error here with Optimum, will be able to get back to this in various moments today, hopefully.)

@agallant
Copy link
Contributor

I'd concur with @zyro that the ideal would be for hugo itself to handle minification as desired. That said, it doesn't seem to do so right now, so the two most convenient approaches I can think of:

In the second case, I think things like gulp/grunt are generally overkill for a fairly normal static site. If you have a truly substantial page with a lot of other dependencies then maybe, but personally I'd just write a bash or python script and be done with it (and be less likely to run into the sorts of strange errors you're hitting).

Minification is a low priority for me (I'm working with small sites that tend to be super responsive simply by being static), but if I revisit in future and try to implement any of the above I'll update here. Good luck!

@JazzTp
Copy link
Author

JazzTp commented Aug 30, 2015

@soycode Thank you. Well... I commented (in the "thread" associated with your issue) about Hugo and minification/optimization being In My Newbie Opinion something completely different from what Hugo does. Hugo doesn't parse our html code, we could throw anything in our templates. That's fine IMNO, Hugo is a great tool as it is already, parsing etc. is really another layer I believe.

My website is very small... yet this tool I already mentioned suggests that I should do something to make it more responsive for cell phones users navigating through their phone service provider data connection... it mentions "blocking resources" (we have some css and js files) and mentions minifying, optimizing, concat, making remote resources local...

I guess the Google search engine is just providing your URL with lower priority to cell phone users searching on Google by keywords, when it assumes that those users' experience wouldn't be that good on your website. Besides, I always like to learn towards the best possible quality.

As for writing scripts... well... apart skipping white space and eventually also CR or CRLF... the rest is a hell of a task, it seems to me. Gulp/Grunt stuff relies on the work of many many people, and the intervention of various modules... yes of course that's also a wider possible source of errors, admittedly.

@agallant
Copy link
Contributor

Optimizing in the name of search rank makes sense and isn't something I'd considered as much, I guess I still view that as a sort of later step but it is worth working on. To be clear, I'm not suggesting writing a script to do the processing directly - rather, the script would just invoke various shell commands (hugo, yuicompressor, and git push for example). So it'd be kind of like gulp/grunt, just more single-purpose.

And on that note, I actually happened across a newer interesting tool that may suit this purpose - http://brunch.io/

I've not tried it myself but may give it a closer look later.

@JazzTp
Copy link
Author

JazzTp commented Aug 30, 2015

@soycode

[...] the script would just invoke various shell commands (hugo, yuicompressor, and git push for example)

Understood. That's actually what gulp does, the author says gulp itself does nothing but calling other tools and possibly piping one's output to another.

But I understand that one can be more comfortable (and possibly dramatically limit the scope of investigation in case of errors) with a self made tool (that was my posture always, years ago, I had even made my own metalanguage for writing, and especially for scriptwriting, with footnotes... easy to switch among "French" "USA" and "Italian" script formatting... when markdown and fountain didn't exist yet... then shell => perl => html).

I'll check out yuicompressor, thank you. I was also tempted to inquire in the optimum page and ask them where I could put some pipe to extract more precise error messages, it's quite possible that that error is a common fall back (or fall out) of errors of any kind, including syntax errors in processed files (so I read in one of the pages linked above, yesterday).

@JazzTp
Copy link
Author

JazzTp commented Sep 3, 2015

I've just posted an update here, you can search for these words to locate it in the page:
have been full steam on this matter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants