mirror of
https://github.com/primer/css.git
synced 2024-11-10 16:07:25 +03:00
expose "lib" (module w/o "primer-" prefix)
This commit is contained in:
parent
ad59be5797
commit
f9dbd4e4dd
@ -159,7 +159,8 @@ module.exports = class PrimerModule extends Generator {
|
|||||||
return acc
|
return acc
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
// this.log("data:", JSON.stringify(data, null, " "))
|
// for the index.scss import
|
||||||
|
data.lib = stripPrimerPrefix(data.module)
|
||||||
|
|
||||||
// copy the whole directory with each file treated as
|
// copy the whole directory with each file treated as
|
||||||
// an EJS template
|
// an EJS template
|
||||||
@ -169,11 +170,8 @@ module.exports = class PrimerModule extends Generator {
|
|||||||
data
|
data
|
||||||
)
|
)
|
||||||
|
|
||||||
// rename lib/module.scss to lib/{name}.scss, where
|
|
||||||
// {name} is the module name without the "primer-" prefix
|
|
||||||
const name = stripPrimerPrefix(this.options.module)
|
|
||||||
const src = path.join(this.basePath, "lib/module.scss")
|
const src = path.join(this.basePath, "lib/module.scss")
|
||||||
const dest = src.replace("module.scss", `${name}.scss`)
|
const dest = src.replace("module.scss", `${data.lib}.scss`)
|
||||||
this.fs.move(src, dest)
|
this.fs.move(src, dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
// support files
|
// support files
|
||||||
@import "primer-support/index.scss";
|
@import "primer-support/index.scss";
|
||||||
@import "./lib/<%= module %>.scss";
|
@import "./lib/<%= lib %>.scss";
|
||||||
|
@ -138,3 +138,13 @@ test("docs are filled in with file contents", t => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("index.scss imports lib/{module}.scss", t => {
|
||||||
|
const module = "primer-select-menu"
|
||||||
|
const lib = "select-menu"
|
||||||
|
return generate({prompts: {module}})
|
||||||
|
.then(path => {
|
||||||
|
assert.fileContent(path("index.scss"), `@import "./lib/${lib}.scss";`)
|
||||||
|
t.pass()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user