-
Notifications
You must be signed in to change notification settings - Fork 27
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
Change Style after packaging #45
Comments
Maybe I should ask if this is a bug? Is there something wrong with my packaging with vue-cli? So far I've only found this problem with the http response package |
Sounds like some sort of build problem... maybe? The highlighting shouldn't be different unless something at the JS level was different between your two environments. Maybe looking closely at your developer tools could help? Look at the rendered code (in your browsers dev tools)... is the auto-detect somehow different? (css lang class) |
|
I found the problem, in the development tool the attributes of the code tag are not loaded with the corresponding CSS, e.g., the class of the highlighted http response in the development environment is hljs xml, in the production environment it is hljs javascript SFC <script setup>
import 'highlight.js/styles/atom-one-dark.css'
import 'highlight.js/lib/common'
import hljs from 'highlight.js/lib/core'
import hljsVuePlugin from '@highlightjs/vue-plugin'
import http from 'highlight.js/lib/languages/http'
import xml from 'highlight.js/lib/languages/xml'
hljs.registerLanguage('http', http)
hljs.registerLanguage('xml', xml)
const highlightjs = hljsVuePlugin.component
import { ref } from 'vue'
const httpResponse = ref('')
const
</script>
<template>
<div>
<highlightjs autodetect :code="httpResponse" />
</div>
</template> |
|
For Json Issue <script setup>
import 'highlight.js/styles/atom-one-dark.css'
import 'highlight.js/lib/common'
import hljs from 'highlight.js/lib/core'
import hljsVuePlugin from '@highlightjs/vue-plugin'
import http from 'highlight.js/lib/languages/http'
import xml from 'highlight.js/lib/languages/xml'
import json from 'highlight.js/lib/languages/json'
hljs.registerLanguage('http', http)
hljs.registerLanguage('xml', xml)
hljs.registerLanguage('json', json)
const highlightjs = hljsVuePlugin.component
const obj = { a: '123', b: '456' }
const jsonOfObj = JSON.stringify(obj)
const
</script>
<template>
<div>
<highlightjs autodetect :code="jsonOfObj" />
</div>
</template> i need render http and json ✅ |
@joshgoebel I think some bundlers ignore side effect imports and only look at package.json's |
I have discovered a new issue based on issue # 44. When I customize an hljs object and the highlighted code I need is HTTP RESPONSE, the highlighted code in the production and development environments is different, as shown in the following two images. The first image is the development environment, which only highlights the HTML; The second image shows the production environment, which only highlights the HTTP response header. Why are the highlighted codes in the production and development environments different? How should I solve the problem of production environments being out of sync with development environments
ps:
Packaging tool: vue/cli 5.0.8
Dependency version: @highlightjs/vue-plugin:^2.1.2
main.js
SFC:
The text was updated successfully, but these errors were encountered: