Wordpress grunt sass向输出文件添加注释

Wordpress grunt sass向输出文件添加注释,wordpress,sass,gruntjs,Wordpress,Sass,Gruntjs,我使用grunt sass在Wordpress主题中输出css 我通常会将css输出到styles.css,并在style.css中使用@import(thestyles.css) 我正在使用respond.js,因此无法在style.css文件中使用@import 我想直接将css输出到style.css,但我需要Wordpress顶部的注释 */ Theme Name: Forum Theme URI: Description: Author: Author URI: Version:

我使用grunt sass在Wordpress主题中输出css

我通常会将css输出到styles.css,并在style.css中使用@import(thestyles.css)

我正在使用respond.js,因此无法在style.css文件中使用@import

我想直接将css输出到style.css,但我需要Wordpress顶部的注释

*/
Theme Name: Forum
Theme URI: 
Description: 
Author:
Author URI: 
Version: 1.0
Tags:
/*
我可以使用横幅添加评论吗

sass: {
  dist: {
    options: {
      banner:
      '
      */
      Theme Name: Forum
      Theme URI: 
      Description: 
      Author:
      Author URI: 
      Version: 1.0
      Tags:
      /*
      '
    },
    files: {
      "src/php/wp-content/themes/forum/style.css": "src/sass/forum/output.scss"
    }
  }
},

你应该放一把枪!因此,旗帜不会被缩小者移除

您可以从package.json中提取信息,如下所示:

在Gruntfile.js中

pkg: pkg: grunt.file.readJSON('package.json'),
sass: {
  dist: {
    options: {
      banner: '/*!\n' +
              ' * Theme Name: Forum\n' +
              ' * Theme URI: <%= pkg.url %>\n' +
              ' * Description: <%= pkg.description %>\n' +
              ' * Author: <%= pkg.author.name %>\n' +
              ' * Author URI: <%= pkg.author.email %>\n' +
              ' * Version: <%= pkg.version %>\n' +
              ' * Tags:\n' +
              ' */\n'
pkg:pkg:grunt.file.readJSON('package.json'),
sass:{
地区:{
选项:{
横幅:'/*!\n'+
“*主题名称:论坛\n”+
“*主题URI:\n”+
“*说明:\n”+
“*作者:\n”+
“*作者URI:\n”+
“*版本:\n”+
“*标记:\n”+
“*/\n”
遗憾的是,在v0.9.0(于2015年2月实现)中,baner选项已从grunt contrib sass中删除。我使用了此任务,它工作正常