mirror of
https://github.com/primer/css.git
synced 2024-09-20 13:17:29 +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
|
||||
}, {})
|
||||
|
||||
// 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
|
||||
// an EJS template
|
||||
@ -169,11 +170,8 @@ module.exports = class PrimerModule extends Generator {
|
||||
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 dest = src.replace("module.scss", `${name}.scss`)
|
||||
const dest = src.replace("module.scss", `${data.lib}.scss`)
|
||||
this.fs.move(src, dest)
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
// support files
|
||||
@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