@nuxtjs/color-mode
Advanced tools
Comparing version 2.0.5 to 2.0.7
@@ -5,2 +5,11 @@ # Changelog | ||
### [2.0.7](https://github.com/nuxt-community/color-mode-module/compare/v2.0.5...v2.0.7) (2021-05-20) | ||
### Bug Fixes | ||
* move script injection into plugin for nitro compat ([#85](https://github.com/nuxt-community/color-mode-module/issues/85)) ([fb31651](https://github.com/nuxt-community/color-mode-module/commit/fb31651d7103a972d2e922d623565d791b84078c)) | ||
### [2.0.6](https://github.com/nuxt-community/color-mode-module/compare/v2.0.5...v2.0.6) (2021-05-20) | ||
### [2.0.5](https://github.com/nuxt-community/color-mode-module/compare/v2.0.4...v2.0.5) (2021-03-10) | ||
@@ -7,0 +16,0 @@ |
@@ -24,6 +24,2 @@ import { resolve } from 'path' | ||
// Add all templates | ||
const templatesDir = resolve(__dirname, 'templates') | ||
await addTemplates.call(this, templatesDir, 'color-mode', options) | ||
// Add script to head to detect user or system preference before loading Nuxt (for SSR) | ||
@@ -34,13 +30,7 @@ const scriptPath = resolve(__dirname, 'script.min.js') | ||
/* istanbul ignore next */ | ||
this.options.head.script = this.options.head.script || [] | ||
this.options.head.script.push({ | ||
hid: options.hid, | ||
innerHTML: script, | ||
pbody: true | ||
}) | ||
options.script = script | ||
const serializeProp = '__dangerouslyDisableSanitizersByTagID' | ||
this.options.head[serializeProp] = this.options.head[serializeProp] || {} | ||
this.options.head[serializeProp][options.hid] = ['innerHTML'] | ||
// Add all templates | ||
const templatesDir = resolve(__dirname, 'templates') | ||
await addTemplates.call(this, templatesDir, 'color-mode', options) | ||
} |
@@ -6,3 +6,15 @@ import Vue from 'vue' | ||
const serializeProp = '__dangerouslyDisableSanitizersByTagID' | ||
const script = { | ||
hid: '<%= options.hid %>', | ||
innerHTML: `<%= options.script %>`, | ||
pbody: true | ||
} | ||
export default function (ctx, inject) { | ||
ctx.app.head.script.push(script) | ||
ctx.app.head[serializeProp] = ctx.app.head[serializeProp] || {} | ||
ctx.app.head[serializeProp]['<%= options.hid %>'] = ['innerHTML'] | ||
const preference = '<%= options.preference %>' | ||
@@ -9,0 +21,0 @@ |
{ | ||
"name": "@nuxtjs/color-mode", | ||
"version": "2.0.5", | ||
"version": "2.0.7", | ||
"description": "Dark and Light mode for NuxtJS with auto detection", | ||
@@ -27,3 +27,3 @@ "repository": "nuxt-community/color-mode-module", | ||
"dependencies": { | ||
"defu": "^3.2.2", | ||
"defu": "^5.0.0", | ||
"lodash.template": "^4.5.0" | ||
@@ -30,0 +30,0 @@ }, |
21415
+ Addeddefu@5.0.1(transitive)
- Removeddefu@3.2.2(transitive)
Updateddefu@^5.0.0