Skip to content
Permalink
Browse files

fix: force rollup output to use .css (#563)

  • Loading branch information...
tivac committed Feb 6, 2019
1 parent 4c0bdd8 commit 8f4348e0a1d46dd08890285b58be15a2bbcfb1f1
@@ -220,8 +220,10 @@ module.exports = (opts) => {
continue;
}

const { name, ext, base } = path.parse(node);
const id = this.emitAsset(base);
const ext = ".css";
const name = path.basename(node, path.extname(node));

const id = this.emitAsset(`${name}${ext}`);

/* eslint-disable-next-line no-await-in-loop */
const result = await processor.output({
@@ -397,6 +397,24 @@ console.log(css);
}
`;

exports[`/rollup.js should output assets with a .css file extension 1`] = `
Object {
"assets/style.css": "
/* packages/rollup/test/specimens/file-extension/style.cssx */
.style {
color: salmon;
}
",
"entry.js": "
var style = {
\\"style\\": \\"style\\"
};

console.log(style);
",
}
`;

exports[`/rollup.js should output unreferenced CSS 1`] = `
Array [
Object {
@@ -15,6 +15,7 @@ const namer = require("@modular-css/test-utils/namer.js");
const logs = require("@modular-css/test-utils/logs.js");

require("@modular-css/test-utils/rollup-code-snapshot.js");
require("@modular-css/test-utils/rollup-build-snapshot.js");

const Processor = require("@modular-css/processor");

@@ -575,6 +576,25 @@ describe("/rollup.js", () => {
logSnapshot();
});

it("should output assets with a .css file extension", async () => {
const bundle = await rollup({
input : require.resolve("./specimens/file-extension/entry.js"),
plugins : [
plugin({
namer,
include : /\.cssx$/
}),
],
});

const result = await bundle.generate({
format,
assetFileNames,
});

expect(result).toMatchRollupSnapshot();
});

describe("case sensitivity tests", () => {
const fs = require("fs");
let fn = it;
@@ -0,0 +1,3 @@
import style from "./style.cssx";

console.log(style);
@@ -0,0 +1,3 @@
.style {
color: salmon;
}

0 comments on commit 8f4348e

Please sign in to comment.
You can’t perform that action at this time.