Skip to content

Conversation

@chenjun1011
Copy link
Contributor

@chenjun1011 chenjun1011 commented Feb 18, 2020

#185

Usage

disable doctype

{
  "plugins": [
    [
      "build-plugin-rax-app",
      {
        "targets": ["web"],
        "doctype": null
      }
    ]
  ]
}

custom doctype

{
  "plugins": [
    [
      "build-plugin-rax-app",
      {
        "targets": ["web"],
        "doctype": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">"
      }
    ]
  ]
}

@yuanyan
Copy link
Contributor

yuanyan commented Feb 18, 2020

可以不需要单独出 web,文档注释上说明即可

{
  "plugins": [
    [
      "build-plugin-rax-app",
      {
        "targets": ["web"],
         "doctype": "none"
      }
    ]
  ]
}

this.command = options.command;

// Disable doctype in `build.json`
this.doctype = options.doctype === 'none' ? '' : '<!DOCTYPE html>';
Copy link
Contributor

Choose a reason for hiding this comment

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

为什么不是 null ?

Copy link
Contributor

Choose a reason for hiding this comment

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

考虑这样

if (options.doctype == null) {
  this.doctype = '';
} else {
  this.doctype = options.doctype;
}

options.doctype 的默认值为 ''

Copy link
Contributor Author

Choose a reason for hiding this comment

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

默认值不能设为 '', 是 breakchange 且用户无感知的

this.command = options.command;

// Disable doctype in `build.json`
this.doctype = options.doctype === null ? '' : `<!DOCTYPE ${options.doctype || 'html'}>`;
Copy link
Contributor

Choose a reason for hiding this comment

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

如果有值,全部由用户来定制即可,这样逻辑上甚至可以支持 xml, <?xml version="1.0" encoding="UTF-8"?>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

@wssgcg1213 wssgcg1213 merged commit cb45f7f into master Feb 20, 2020
@wssgcg1213 wssgcg1213 deleted the feat-disable-doctype branch February 20, 2020 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants