discuss icon indicating copy to clipboard operation
discuss copied to clipboard

Unable to use PurgeCSS due to CssSyntaxError

Open aixaqh opened this issue 4 years ago • 1 comments

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

aixaqh avatar Oct 22 '19 21:10 aixaqh

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 👍

hacknug avatar Oct 29 '19 18:10 hacknug