tailwindlabs / discuss

A place to ask questions, get help, or share what you've built with Tailwind CSS.
MIT License
171 stars 9 forks source link

Unable to use PurgeCSS due to CssSyntaxError #368

Open aixaqh opened 5 years ago

aixaqh commented 5 years ago

const Purgecss = require('purgecss') const fs = require('fs') const path = require('path') const outputDir = path.resolve(__dirname,'dist')

const purgecss = new Purgecss({

content:[   'office/autoship/*.aspx',  
            'office/communication-center/*.aspx', 
            'office/Dashboards/*.aspx',
            'office/genealogy/*.aspx',
            'office/home/*.aspx',
            'office/profile/*.aspx',
            'office/reports/*.aspx',
            'office/user-resources/*.aspx',
            'office/wallet/*.aspx'],

css:[       
            // 'src/**/*.css',
            'secure/css/*.css',
            // 'office/src/css/*.css',
            // 'office/wallet/src/css/*.css',
            // 'office/reports/src/css/*.css',
            // 'office/profile/src/css/*.css',
            // 'office/home/src/css/*.css',
            // 'office/genealogy/src/css/*.css',
            // 'office/Dashboards/src/css/*.css'
        ],
extractors: [
            {
              extractor: class {
                static extract(content) {
                  return content.match(/[A-z0-9-:\/]+/g) || []
                }
              },
              extensions: ['html', 'js']
            }
          ]

}) const result = purgecss.purge()

result.forEach(out => { const filePath = out.file.split('/') fs.writeFileSync('${outputDir}/${filePath[filePath.length - 1]}', out.css, 'utf-8') })

console.log('done');

dont work

hacknug commented 5 years ago

Probably an issue with your the way your project is set up. If you can share a repo, someone might be able to help you out debugging it. Better suited for /discuss 👍