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

Adding Submodule #663

Closed
wants to merge 3 commits into from
Closed

Adding Submodule #663

wants to merge 3 commits into from

Conversation

stevenjoezhang
Copy link
Contributor

@stevenjoezhang stevenjoezhang commented Mar 7, 2019

Breaking Change:

Install new modules:

git submodule init fancybox pangu
git submodule update

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines.
  • Tests for the changes was maked (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs in NexT website have been added / updated (for new features).

PR Type

What kind of change does this PR introduce?

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Build related changes.
  • CI related changes.
  • Documentation content changes.
  • Other... Please describe:

What is the current behavior?

Issue resolved: #413

What is the new behavior?

  • Screenshots with this changes: N/A
  • Link to demo site with this changes: N/A

How to use?

In NexT _config.yml:

...

Does this PR introduce a breaking change?

  • Yes.
  • No.

@1v9
Copy link
Member

1v9 commented Mar 7, 2019

fancybox3 & gitment?

@stevenjoezhang
Copy link
Contributor Author

Gitment is not designed to be cloned. It just provides a jsDelivr CDN, because the origin Gitment repo is not maintained
fancybox3 and fancybox both uses /source/lib/fancybox, to avoid potential conflict, I choose fancybox3

.gitmodules Outdated Show resolved Hide resolved
@stevenjoezhang stevenjoezhang requested a review from 1v9 March 7, 2019 05:59
1v9
1v9 previously approved these changes Mar 7, 2019
@1v9
Copy link
Member

1v9 commented Mar 7, 2019

Need update much docs README...

@1v9 1v9 self-requested a review March 7, 2019 06:04
@1v9 1v9 dismissed their stale review March 7, 2019 06:11

tarvis-ci fasiled

@1v9
Copy link
Member

1v9 commented Mar 7, 2019

@stevenjoezhang
Copy link
Contributor Author

Seems tarvis-ci does not know how to clone a repo with ssl

@ivan-nginx
Copy link
Member

ivan-nginx commented Mar 7, 2019

Don't totally understand: for what this needed?


Also, Travis make error on 'source/lib/fancybox' module.

@jiangtj
Copy link
Member

jiangtj commented Mar 7, 2019

Don't totally understand: for what this needed?

Confusion too. Submodule can be done by user.

@stevenjoezhang
Copy link
Contributor Author

This allows users installing dependencies using a simple command, no longer need to check and follow the instructions in README.md of these ‘theme-next-*’ repos

@jiangtj
Copy link
Member

jiangtj commented Mar 7, 2019

This allows users installing dependencies using a simple command, no longer need to check and follow the instructions in README.md of these ‘theme-next-*’ repos

Some GUI tools would clone all submodule when once clone, such as GitHub desktop......
But I don't use all.

@LEAFERx
Copy link
Contributor

LEAFERx commented Mar 7, 2019

Personally, instead of git submodule, I prefer that plugins be hexo plugins (npm packages), and insert to theme using hexo tags.
For example, if you want jquery, you can create a plugin that provides {% jquery-script %} called hexo-jquery and users can just simply install it and change _config.yml to set useJquery: Ture.
It is convenient for users and can be simply reused by other themes.
Think about that lol. Why a theme plugin is not a hexo plugin?

@LEAFERx
Copy link
Contributor

LEAFERx commented Mar 7, 2019

@ivan-nginx
Copy link
Member

Guys, check here before resume discussion of this PR.

@LEAFERx
Copy link
Contributor

LEAFERx commented Mar 7, 2019

Guys, check here before resume discussion of this PR.

Yes it's a great view. And automatic download may be easier to be done by npm packages lol.

@1v9
Copy link
Member

1v9 commented Mar 7, 2019

Philosophical debate is coming🤔. I think if there's not a good solution just don't change anything.

@ivan-nginx
Copy link
Member

ivan-nginx commented Mar 7, 2019

automatic download may be easier to be done by npm packages

There is some problems with it:

  1. node_modules path is different from themes path. But it's not critical and may be solved, of course.
  2. For now NexT used Netlify for deploy and each time during generate Netlify reinstall node_modules, but not NexT theme. See logs here and here, for example. In 1st logs NexT just updated needed files; in 2nd – don't touch because «Already up to date». I'm talking about traffic, Netlify give 100GB per month.

But maybe node_modules cached somehow, I'm not sure. However, as an option we can try to move modules from Git repos to NPM and check it for traffic.


BTW, if we talking about NPM, maybe NexT can live on NPM too? But it's a little bit extra work: make release on Git, then make release on NPM. Need to think about it.

@jiangtj
Copy link
Member

jiangtj commented Mar 7, 2019

About npm.
I think the main problem is swig. Something written in swig file. How to solved it?

@ivan-nginx
Copy link
Member

What swig? NPM can include any files. Moreover, almost all functions can be moved from swig to js files in scripts directory. But on it will wasted some time, of course.

@jiangtj
Copy link
Member

jiangtj commented Mar 7, 2019

Such as comments:

{% if theme.disqus.enable %}
  {% include 'disqus.swig' %}
{% elif theme.changyan.enable and theme.changyan.appid and theme.changyan.appkey %}
......

We need config in comment index.swig, If we use npm, need wasted some time to add code in the right place. But it's not easy.

@jiangtj
Copy link
Member

jiangtj commented Mar 7, 2019

100GB per month

Only when a user visits a page will it consume. So don't worry reinstall node_modules.

@ivan-nginx
Copy link
Member

ivan-nginx commented Mar 7, 2019

We need config in comment index.swig, If we use npm, need wasted some time to add code in the right place.

Maybe. But u talking now about NexT. Need to make decision about modules firstly.

Only when a user visits a page will it consume

Yeah? Are u sure downloading packages / repos (deploying) not waste this traffic?


For now: 382 MB/100 GB. It's 7 days usage.

@LEAFERx
Copy link
Contributor

LEAFERx commented Mar 7, 2019

By hexo plugins I mean install in root of the blog, not in NexT.
I'm working on the leancloud conuter refactor including modulize and automatic setup. I can show you how I design the module to work when I'm finished. Hope I can finish before next week.

Such as comments:

{% if theme.disqus.enable %}
  {% include 'disqus.swig' %}
{% elif theme.changyan.enable and theme.changyan.appid and theme.changyan.appkey %}
......

We need config in comment index.swig, If we use npm, need wasted some time to add code in the right place. But it's not easy.

Sure current code need refactor. But we can do it step by step and still keep those small pieces inside. And automatic install dependencies for NexT does excite me a lot.

automatic download may be easier to be done by npm packages

There is some problems with it:

  1. node_modules path is different from themes path. But it's not critical and may be solved, of course.
  2. For now NexT used Netlify for deploy and each time during generate Netlify reinstall node_modules, but not NexT theme. See logs here and here, for example. In 1st logs NexT just updated needed files; in 2nd – don't touch because «Already up to date». I'm talking about traffic, Netlify give 100GB per month.

But maybe node_modules cached somehow, I'm not sure. However, as an option we can try to move modules from Git repos to NPM and check it for traffic.

BTW, if we talking about NPM, maybe NexT can live on NPM too? But it's a little bit extra work: make release on Git, then make release on NPM. Need to think about it.

Netlify do cache npm modules. see here

@1v9 1v9 removed their request for review March 9, 2019 15:33
@stevenjoezhang
Copy link
Contributor Author

stevenjoezhang commented Jul 13, 2020

Superseded by https://github.com/next-theme/plugins

GitHub
Plugins for Hexo theme NexT. Contribute to next-theme/plugins development by creating an account on GitHub.

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

Successfully merging this pull request may close these issues.

仓库根目录 .gitignore 文件中的嵌套 exclusion 规则无效
5 participants