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

Add css: false #6

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
19 changes: 19 additions & 0 deletions test/fixtures/css.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<p>Count: {{count}}</p>
<button on:click='set({ count: count + 1 })'>+1</button>
<style>
button {
width: 50px;
height: 50px;
}
</style>

<script>
export default {
data () {
return {
count: 0
};
}
};
</script>
16 changes: 15 additions & 1 deletion test/loader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 })
);

});


Expand Down