Closed jerryc127 closed 5 years ago
are you using gulp v4? note gulp v4 uses gulp.series and gulp.parallel. see https://github.com/hexojs/site/pull/946 and https://fettblog.eu/gulp-4-parallel-and-series/
what is the installed version of gulp (npm ls --depth 0
)? attach your package.json as well.
if you use gulp v4, update the syntax by replacing the following lines:
gulp.task('default', [
'minify-html','minify-css','minify-images','es'
]);
to
gulp.task('default',
gulp.parallel('minify-html','minify-css','minify-images','es'
));
btw, I wrote a minify assets plugin (hexo-yam). It also compresses them to gzip and brotli. But it doesn't support image compression though.
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"hexo": {
"version": "3.8.0"
},
"dependencies": {
"gulp": "^3.9.1",
"gulp-clean-css": "^3.10.0",
"gulp-htmlclean": "^2.7.22",
"gulp-htmlmin": "^4.0.0",
"gulp-imagemin": "^5.0.3",
"gulp-minify-css": "^1.2.4",
"gulp-uglify": "^3.0.2",
"hexo": "^3.2.0",
"hexo-abbrlink": "^2.0.5",
"hexo-algolia": "^1.3.1",
"hexo-asset-image": "0.0.3",
"hexo-deployer-git": "^1.0.0",
"hexo-generator-archive": "^0.1.4",
"hexo-generator-baidu-sitemap": "^0.1.2",
"hexo-generator-category": "^0.1.3",
"hexo-generator-feed": "^1.2.2",
"hexo-generator-index-pin-top": "^0.2.2",
"hexo-generator-search": "^2.2.5",
"hexo-generator-sitemap": "^1.2.0",
"hexo-generator-tag": "^0.2.0",
"hexo-nofollow": "^1.0.6",
"hexo-offline": "^1.0.0",
"hexo-renderer-ejs": "^0.3.0",
"hexo-renderer-jade": "^0.4.1",
"hexo-renderer-less": "^1.0.0",
"hexo-renderer-marked": "^0.3.0",
"hexo-renderer-stylus": "^0.3.3",
"hexo-server": "^0.2.0",
"hexo-tag-aplayer": "^3.0.4",
"hexo-wordcount": "^3.0.2"
},
"scripts": {
"push": "hexo clean & hexo algolia && hexo g && gulp && hexo deploy",
"show": "hexo clean && hexo g && hexo s",
"update": "git init && git add . && git commit -m 'update' && git push -u origin master"
},
"devDependencies": {
"gulp-terser": "^1.1.7"
}
}
i use gulp v3
do you know the source of the html code in your screenshot? run hexo g
without gulp and look for anomaly in the generated html.
the html code in the screensho: view-source:https://jerryc.me/posts/125d29fb/
the hexo deploy is work when i run without gulp
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Jerry\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'push' ]
2 info using npm@6.9.0
3 info using node@v10.15.1
4 verbose run-script [ 'prepush', 'push', 'postpush' ]
5 info lifecycle hexo-site@0.0.0~prepush: hexo-site@0.0.0
6 info lifecycle hexo-site@0.0.0~push: hexo-site@0.0.0
7 verbose lifecycle hexo-site@0.0.0~push: unsafe-perm in lifecycle true
8 verbose lifecycle hexo-site@0.0.0~push: PATH: C:\Users\Jerry\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\JerryBlog\node_modules\.bin;C:\Users\Jerry\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Jerry\bin;C:\Program Files\Java\jdk1.8.0_201\bin;C:\Program Files\Java\jdk1.8.0_201\jre\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;%SYSTEMROOT%\System32\OpenSSH;C:\Users\Jerry\AppData\Local\Microsoft\WindowsApps;C:\Users\Jerry\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Jerry\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle hexo-site@0.0.0~push: CWD: D:\JerryBlog
10 silly lifecycle hexo-site@0.0.0~push: Args: [ '/d /s /c',
10 silly lifecycle 'hexo clean & hexo algolia && hexo g && gulp && hexo deploy' ]
11 silly lifecycle hexo-site@0.0.0~push: Returned: code: 1 signal: null
12 info lifecycle hexo-site@0.0.0~push: Failed to exec push script
13 verbose stack Error: hexo-site@0.0.0 push: `hexo clean & hexo algolia && hexo g && gulp && hexo deploy`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Jerry\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Jerry\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid hexo-site@0.0.0
15 verbose cwd D:\JerryBlog
16 verbose Windows_NT 10.0.18898
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Jerry\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "push"
18 verbose node v10.15.1
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error hexo-site@0.0.0 push: `hexo clean & hexo algolia && hexo g && gulp && hexo deploy`
22 error Exit status 1
23 error Failed at the hexo-site@0.0.0 push script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Since the page contains xml, I think the issue could be similar to #3 and https://github.com/cheeriojs/cheerio/issues/1198 .
To better pinpoint the issue:
Try hexo-autonofollow which uses older version of cheerio.
Upgrade gulp to v4 and use gulp.series to find out which gulp task failed, Replace
gulp.task('default', [
'minify-html','minify-css','minify-images','es'
]);
with
gulp.task('default',
gulp.series('minify-html','minify-css','minify-images','es'
));
Try hexo-yam, you need to remove 'minify-html', 'minify-css' and 'es' gulp task.
Attach the source .md file of https://jerryc.me/posts/125d29fb/ , and I'll try to replicate.
From the screenshot, I just noticed there is an extra <
in <<span class
. This might be your typo or added by this plugin. Usually minifier would throw an error if there is any invalid syntax.
Can you check the generated index.html
of that post? I don't find the typo in https://jerryc.me/posts/125d29fb/, but the html is already minified?
the extra < in <<span class
the error
i sure the html is already minified
i try to use the https://github.com/liuzc/hexo-autonofollow it work for me.
this is the .md file of https://jerryc.me/posts/125d29fb/ https://drive.google.com/file/d/1e4moJWfINF0j1nhgv8gTNwqEi6yPRHf7/view?usp=sharing
I meant I expected the html not to be minified if gulp is skipped. Anyway, I requested access from j***@gmail.com
Edit: I can reproduce with
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button 1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button 2"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button 3"
/>
the bracket is supposed to be escaped (in the generated html),
<<span class="name">LinearLayout</span>
I used this workaround https://github.com/cheeriojs/cheerio/issues/1198#issuecomment-481589878.
Edit: I just tested with hexo-yam, which includes html-minifier. It worked.
Edit: https://github.com/cheeriojs/dom-serializer/pull/80 looks promising.
sorry,I'm not good at English. it mean? how i solve this problem?
I'm trying to figure out should I default decodeEntities
to true
instead.
When I use this fix (https://github.com/cheeriojs/dom-serializer/pull/80) and set decodeEntities
to false:
&amp;amp;lt;!-- some mandarin comment 取值范围 --&amp;amp;gt;
&amp;amp;lt;LinearLayout xmlns:android=&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;
android:layout_width=&amp;quot;match_parent&amp;quot;
android:layout_height=&amp;quot;match_parent&amp;quot;
android:orientation=&amp;quot;horizontal&amp;quot;
&amp;amp;gt;
If I set to true:
<!-- some mandarin comment 取值范围 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
I put together a small change so you can test https://github.com/cheeriojs/dom-serializer/pull/80 easily, replace the relevant line in package.json to:
"hexo-nofollow": "weyusi/hexo-nofollow#decode-test",
@momocow can you help to test this too?
Edit: you might encounter this issue https://stackoverflow.com/q/27356915, just make sure the installed modules do not have '.git' folder.
when hexo deploy, it work.
no issue even with gulp? check for any unusual symbols in the generated html. I can release an alpha version in the meantime.
no issue even with gulp? yes
the gulpfile.js