packages/zent/scripts/new-component.js
function insertCss(name) {
  const cssIndexPath = path.resolve(__dirname, '../assets/index.scss');
  const cssIndexFile = fs.readFileSync(cssIndexPath, { encoding: 'utf-8' });
  const cssImportStr = `@import './${name}';`;

  const cssIndexFileArr = cssIndexFile.trim().split('\n');
  cssIndexFileArr.push(cssImportStr);

  // Make sure base comes first
  const base = cssIndexFileArr.splice(0, 1);
  sortByModulePath(cssIndexFileArr);
  cssIndexFileArr.unshift(base);

  fs.writeFileSync(cssIndexPath, `${cssIndexFileArr.join('\n')}\n`);
}
function insertCss(name) {
  const cssIndexPath = path.resolve(__dirname, '../assets/index.scss');
  const cssIndexFile = fs.readFileSync(cssIndexPath, { encoding: 'utf-8' });
  const cssImportStr = `@import './${name}';`;

  const cssIndexFileArr = cssIndexFile.trim().split('\n');
  cssIndexFileArr.push(cssImportStr);

  // Make sure base comes first
  const base = cssIndexFileArr.splice(0, 1);
  sortByModulePath(cssIndexFileArr);
  cssIndexFileArr.unshift(base);

  fs.writeFileSync(cssIndexPath, `${cssIndexFileArr.join('\n')}\n`);
}
function insertCss ( name ) { const cssIndexPath = path . resolve ( __dirname , '../assets/index.scss' ) ; const cssIndexFile = fs . readFileSync ( cssIndexPath , { encoding : 'utf-8' } ) ; const cssImportStr = ` ${ name } ` ; const cssIndexFileArr = cssIndexFile . trim ( ) . split ( '\n' ) ; cssIndexFileArr . push ( cssImportStr ) ; // Make sure base comes first const base = cssIndexFileArr . splice ( 0 , 1 ) ; sortByModulePath ( cssIndexFileArr ) ; cssIndexFileArr . unshift ( base ) ; fs . writeFileSync ( cssIndexPath , ` ${ cssIndexFileArr . join ( '\n' ) } \n ` ) ; }
style
style