Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM package doesn't have pug support #271

Open
ahmadalfy opened this issue Jun 7, 2017 · 0 comments
Open

NPM package doesn't have pug support #271

ahmadalfy opened this issue Jun 7, 2017 · 0 comments

Comments

@ahmadalfy
Copy link

Pug support was added last year still the packages are not in sync. This is the content of the default-file-types.js

var regex = {
  block: {
    '//': /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi
  }
};

module.exports = {
  html: {
    block: /(([ \t]*)<!--\s*bower:*(\S*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi,
    detect: {
      js: /<script.*src=['"]([^'"]+)/gi,
      css: /<link.*href=['"]([^'"]+)/gi
    },
    replace: {
      js: '<script src="{{filePath}}"></script>',
      css: '<link rel="stylesheet" href="{{filePath}}" />'
    }
  },
  
  js: {
    block: regex.block['//'],
    detect: {
      js: /['"]([^'"]+\.js)['"],?/gi,
      css: /['"]([^'"]+\.js)['"],?/gi
    },
    replace: {
      js: '"{{filePath}}",',
      css: '"{{filePath}}",'
    }
  },

  jade: {
    block: /(([ \t]*)\/\/-?\s*bower:*(\S*))(\n|\r|.)*?(\/\/-?\s*endbower)/gi,
    detect: {
      js: /script\(.*src=['"]([^'"]+)/gi,
      css: /link\(.*href=['"]([^'"]+)/gi
    },
    replace: {
      js: 'script(src=\'{{filePath}}\')',
      css: 'link(rel=\'stylesheet\', href=\'{{filePath}}\')'
    }
  },

  slim: {
    block: /(([ \t]*)\/!?\s*bower:(\S*))(\n|\r|.)*?(\/!?\s*endbower)/gi,
    detect: {
      js: /script.*src=['"]([^'"]+)/gi,
      css: /link.*href=['"]([^'"]+)/gi
    },
    replace: {
      js: 'script src=\'{{filePath}}\'',
      css: 'link rel=\'stylesheet\' href=\'{{filePath}}\''
    }
  },

  less: {
    block: regex.block['//'],
    detect: {
      css: /@import\s['"](.+css)['"]/gi,
      less: /@import\s['"](.+less)['"]/gi
    },
    replace: {
      css: '@import "{{filePath}}";',
      less: '@import "{{filePath}}";'
    }
  },

  sass: {
    block: regex.block['//'],
    detect: {
      css: /@import\s(.+css)/gi,
      sass: /@import\s(.+sass)/gi,
      scss: /@import\s(.+scss)/gi
    },
    replace: {
      css: '@import {{filePath}}',
      sass: '@import {{filePath}}',
      scss: '@import {{filePath}}'
    }
  },

  scss: {
    block: regex.block['//'],
    detect: {
      css: /@import\s['"](.+css)['"]/gi,
      sass: /@import\s['"](.+sass)['"]/gi,
      scss: /@import\s['"](.+scss)['"]/gi
    },
    replace: {
      css: '@import "{{filePath}}";',
      sass: '@import "{{filePath}}";',
      scss: '@import "{{filePath}}";'
    }
  },

  styl: {
    block: regex.block['//'],
    detect: {
      css: /@import\s['"](.+css)['"]/gi,
      styl: /@import\s['"](.+styl)['"]/gi
    },
    replace: {
      css: '@import "{{filePath}}"',
      styl: '@import "{{filePath}}"'
    }
  },

  yaml: {
    block: /(([ \t]*)#\s*bower:*(\S*))(\n|\r|.)*?(#\s*endbower)/gi,
    detect: {
      js: /-\s(.+js)/gi,
      css: /-\s(.+css)/gi
    },
    replace: {
      js: '- {{filePath}}',
      css: '- {{filePath}}'
    }
  },

  haml: {
    block: /(([ \t]*)-#\s*bower:*(\S*))(\n|\r|.)*?(-#\s*endbower)/gi,
    detect: {
      js: /\%script\{.*src:['"]([^'"]+)/gi,
      css: /\%link\{.*href:['"]([^'"]+)/gi
    },
    replace: {
      js: '%script{src:\'{{filePath}}\'}',
      css: '%link{rel:\'stylesheet\', href:\'{{filePath}}\'}'
    }
  }
};


module.exports['default'] = module.exports.html;
module.exports.htm = module.exports.html;
module.exports.yml = module.exports.yaml;

I know the workarounds to get pug working, just please fix the npm package.

Thank you

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

No branches or pull requests

1 participant