- bumped postcss and postcss-loader versions
- removed deprecated custom logic related to setting up PostCSS
- updated tests
As communicated in #307 and on the related PR from @stylesuxx on the
template repo we can use PostCSS` more recent config file feature
instead of modifying our config.
If users prompt the PostCSS question with yes, deps for postcss and
postcss-loader are added to their package.json.
The updated tests check that
- postcss and postcss-loader deps are added on PostCSS yes
- postcss and postcss-loader deps are not added on PostCSS no
- postcss.config.js is copied to the project root
v2.0.1-6 contains important updates to conf/webpack/Test.js that fix
running tests on components using css modules and a css preprocessor
(less, s(c|a)ss, stylus).
This feature allows users to put a `cssClsPrefix` property into their
.yo-rc.json. If configured, the component generator will add this string
as a prefix to className attributes.
Example:
// .yo-rc.json
{
"generator-react-webpack": {
"appName": "v4-latest-install",
"style": "css",
"cssmodules": false,
"cssClsPrefix": "myapp",
"postcss": false,
"generatedWithVersion": 4
}
}
Components generated will now prepend the `myapp` prefix on their class
names, e.g.
$ yo react-webpack:component hello
<div className="myapp-hello-component" />
This subgen creates a new Webpack config environment by
- creating conf/webpack/<EnvName>.js
- creating src/config/<env_name>.js
- requiring and exporting the new env in conf/webpack/index.js
The commit introduces a basic config template that is supposed to be populated by the generator's users. Various more fine grained subgen options can be added at a later time (e.g. prompting the user if new run scripts should be added to package.json).
The subgen's basic functionality is backed up by unit tests that check
- if files are created
- if conf/webpack/index.js contains correct import/export
* Updated tessts to successfully run against current master of the template
* Updated postcss attachement to new webpack config. Adjusted tests.
* Updated dependencies
* Use newest template
* Updated Esprima
This commit refactors the template structure for components to multiple
different base templates based on the required styling options:
- nostyle
- with styles
- with styles and css modules
Wrapped Node's path.normalize() around paths that have
`componentPartPath` as a part segment. For non-namespaced components
this segment can be empty which leads to two consecutive slashes.
Updated test suite to assert against the updated import statements
in various files.