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

fix(module): warn about head as a function in nuxt config is not supported #14

Merged
merged 4 commits into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions example/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ const { resolve } = require('path')
module.exports = {
rootDir: resolve(__dirname, '..'),
buildDir: resolve(__dirname, '.nuxt'),
head () {
return {
title: '@nuxtjs/gtm-module'
}
},
srcDir: __dirname,
render: {
resourceHints: false
Expand Down
5 changes: 5 additions & 0 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ module.exports = async function gtmModule (_options) {
script = `if(!window._gtm_init){window._gtm_init=1;${script}}`

// Add google tag manager <script> to head
if (typeof this.options.head === 'function') {
// eslint-disable-next-line no-console
console.warn('[@nuxtjs/gtm] head is provided as a function which is not supported by this module at the moment. Removing user-provided head.')
this.options.head = typeof this.options.head === 'function' ? {} : this.options.head
Copy link
Member

Choose a reason for hiding this comment

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

I think this typeof check is not necessary anymore (upper-level condition is checking)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm fixing.. T0T

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link
Contributor Author

@hagi4u hagi4u Feb 26, 2020

Choose a reason for hiding this comment

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

am i try to first Open Source PR of my develop life.. please understand to insufficient processes.

Copy link
Member

Choose a reason for hiding this comment

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

NP! Happy to hear you are willing to do more OSS stuff :) Wish to see more contributions by you 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm glad you, i will try to fix and improve more OSS!
thanks

}
this.options.head.script = this.options.head.script || []
this.options.head.script.push({
hid: options.scriptId,
Expand Down