Skip to content

Added Hexo and NexT environment variables.#240

Merged
ivan-nginx merged 2 commits intomasterfrom
feature-env
Apr 17, 2018
Merged

Added Hexo and NexT environment variables.#240
ivan-nginx merged 2 commits intomasterfrom
feature-env

Conversation

@ivan-nginx
Copy link
Member

  1. Replaced Hexo version by full env variable. Here is values: https://github.com/hexojs/hexo/blob/373b9c745cb5dfe25e942e720aca2cdac78e1874/lib/hexo/index.js#L47-L55
  2. From this moment version of NexT will be readed from package.json file. So, no need to set version in NexT _config.yml file anymore. Also, all other values from package.json can be readed with next_env('value') function in template.
  3. Edited package.json and bower.json (correct author values, some tags).

1. Replaced Hexo version by full `env` variable. Here is values: https://github.com/hexojs/hexo/blob/373b9c745cb5dfe25e942e720aca2cdac78e1874/lib/hexo/index.js#L47-L55
2. From this moment version of NexT will be readed from `package.json` file. So, no need to set version in NexT `_config.yml` file anymore. Also, all other values from `package.json` can be readed with `next_env('value')` function in template.
3. Edited `package.json` and `bower.json` (correct author values, some tags).
});

hexo.extend.helper.register('next_env', function(type) {
var env = require('../package.json');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'require' is not defined.

return this.env[type];
});

hexo.extend.helper.register('next_env', function(type) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'hexo' is not defined.

@@ -1,5 +1,14 @@
'use strict';

hexo.extend.helper.register('hexo_env', function(type) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'hexo' is not defined.

@ivan-nginx ivan-nginx added this to the v6.3.0 milestone Apr 17, 2018
@ivan-nginx ivan-nginx merged commit 1f9ef9c into master Apr 17, 2018
@ivan-nginx ivan-nginx deleted the feature-env branch April 17, 2018 19:59
tongluyang pushed a commit to tongluyang/hexo-theme-next that referenced this pull request Nov 19, 2019
* Added Hexo and NexT environment variables.

1. Replaced Hexo version by full `env` variable. Here is values: https://github.com/hexojs/hexo/blob/373b9c745cb5dfe25e942e720aca2cdac78e1874/lib/hexo/index.js#L47-L55
2. From this moment version of NexT will be readed from `package.json` file. So, no need to set version in NexT `_config.yml` file anymore. Also, all other values from `package.json` can be readed with `next_env('value')` function in template.
3. Edited `package.json` and `bower.json` (correct author values, some tags).

* Added `require` and `hexo` to excludes.
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