diff --git a/index.js b/index.js index 10872dda..df2333df 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,7 @@ module.exports = function(source, map) { filename: filename, format: query.format || 'es', name: query.name, + css: query.css !== false, onerror: (err) => { console.log(err.message); this.emitError(err.message); diff --git a/test/fixtures/css.html b/test/fixtures/css.html new file mode 100644 index 00000000..95fe1ebd --- /dev/null +++ b/test/fixtures/css.html @@ -0,0 +1,19 @@ +

Count: {{count}}

+ +​ + + + \ No newline at end of file diff --git a/test/loader.spec.js b/test/loader.spec.js index fc0b0c2e..71f024db 100644 --- a/test/loader.spec.js +++ b/test/loader.spec.js @@ -72,7 +72,7 @@ describe('loader', function() { ); - it('should compile Component with with nesting', + it('should compile Component with nesting', testLoader('test/fixtures/parent.html', function(err, code, map) { expect(err).not.to.exist; @@ -100,6 +100,20 @@ describe('loader', function() { }, { format: 'umd', name: 'FooComponent' }) ); + it('should compile Component with css by default', + testLoader('test/fixtures/css.html', function(err, code, map) { + expect(err).not.to.exist; + expect(code).to.contain('if ( !addedCss ) addCss();'); + }) + ); + + it('should compile Component without css if requested', + testLoader('test/fixtures/css.html', function(err, code, map) { + expect(err).not.to.exist; + expect(code).not.to.contain('if ( !addedCss ) addCss();'); + }, { css: false }) + ); + });