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

Add main-noplugins.min.js #1245

Closed
wants to merge 2 commits into from
Closed

Conversation

ohadschn
Copy link
Contributor

@ohadschn ohadschn commented Sep 12, 2017

For custom footer script consumption per #1241 (comment).

@ohadschn
Copy link
Contributor Author

ohadschn commented Sep 13, 2017

I added main-noplugins.min.js to source control because that appears to be the convention, but I think ideally generated files shouldn't reside in the source control. I know very little about Ruby, but according to the docs, perhaps the RakeFile would be the most reasonable place to put the uglifyjs command?

@mmistakes
Copy link
Owner

I'm not in love with any of these. The name -noplugins is misleading.

I really don't think this needs to live in the theme as it's not something most users will need. It's adding extra complexity which I'm not a fan of.

@mmistakes
Copy link
Owner

Since all of the source files for the scripts are included, there is nothing stopping you from doing what you need to them. If that means running uglify to build just a minified version of _main.js without all the plugins included that should be doable.

If you're using a CI it's even easier since to my knowledge they allow you to run scripts at various points in the build process.

The reality is you've outgrown a pre-built theme for the masses and you either need to jump through hoops of this sort or better yet, build your own theme. That's exactly what I did years ago when I first started with Jekyll.

@ohadschn
Copy link
Contributor Author

Feel free to name it anything you want, I'm not in love with the name either :) As long as I have a file I can efficiently include in my footer script I'll be happy.

Seeing as the new footer script feature will prevent the inclusion of the main.min.js, and seeing as how users might want to use jQuery etc. in their custom scripts which would necessitate their separate inclusion, this would be a perfect fit.

IMHO literally less than one line of code that creates some files that as you said most people won't care about is not much of an added complexity...

@ohadschn
Copy link
Contributor Author

Yeah I suppose you are right about adding it to the CI, should be pretty trivial to add something like:

uglifyjs "$(bundle show minimal-mistakes-jekyll)/assets/js/_main.js" -c -m \
         -o assets/js/main-unbundled.min.js

(hope you like the new name)

However I decided to stick with the full main.min.js for now so I don't have to worry about adding/removing/changing plugins on upgrades.

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

Successfully merging this pull request may close these issues.

2 participants