我的应用程序和组件的名称间距遵循以下约定:
<div id="app-name">
<ul class="list">
<li>item</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
#app-name {
.list {
margin: 0;
}
}
Run Code Online (Sandbox Code Playgroud)
我想使用 CSS 模块,但是,我不确定如何对其进行转换并保持应用程序和组件名称间距的相同特异性。我知道我可以简单地省略整个#app-nameID,但我想要这种特殊性。
想法?
给出这两个示例表:
authors(
id SERIAL PRIMARY KEY,
name VARCHAR(60) UNIQUE,
profession VARCHAR(30)
)
posts(
id SERIAL PRIMARY KEY,
text TEXT,
author_id INT REFERENCES authors(id)
)
Run Code Online (Sandbox Code Playgroud)
作者表有所有作者,但现在我正在尝试填充posts表,我有一组数据,基本上有一个带有作者姓名的帖子,但我想查询author_id以便我可以如下插入引号表:
INSERT INTO posts(text, author_id) VALUES(
/*
pseudo broken-code
SELECT post, author FROM posts_temp (where all of the data temp resides),
SELECT id FROM authors WHERE authors.name = author.name (obviously this is wrong, but the idea is getting the id from the authors table that matches the author name from the selection above)
*/
)
Run Code Online (Sandbox Code Playgroud) 我的印象是,当我使用Webpack部署到Heroku基于反应的应用程序时,我不需要包含devDependencies.例如,这是我的包裹.
"scripts": {
"test": "",
"start": "./node_modules/.bin/babel-node server",
"build": "rimraf dist && export NODE_ENV=production && webpack --config ./webpack.production.config.js --progress --profile --colors",
"postinstall": "node deploy",
"eslint": "eslint .",
"jscs": "jscs ."
},
Run Code Online (Sandbox Code Playgroud)
和deploy.js:
if (process.env.NODE_ENV === 'production') {
var child_process = require('child_process');
child_process.exec("webpack -p --config webpack.production.config.js", function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
}
Run Code Online (Sandbox Code Playgroud)
和Procfile
web ./node_modules/.bin/babel-node server.js
Run Code Online (Sandbox Code Playgroud)
但是,当我推送到Heroku时,我经常得到一个无法识别的webpack命令,因此我将所有devDependencies作为正常依赖项包含在内以使其正常工作.我在这里错过了什么吗?
我希望能够为我的所有组件设置一个全局主题(变量集)来继承和扩展它们的默认变量.例如,我有一个button具有默认样式(内联CSS)的组件,它引用一组变量,例如primaryColor,......我希望能够在不使用这些组件的情况下轻松更新这些变量而无需显式将它们传递给组件.
例如,我想要以下行为,我可以(1)将它们包装在一个组件中并primaryColor级联到每个Button组件或(2)将该组件导出到更高阶的组件中并且更新道具等.但是,我无法使用这些方法.也许,还有更好的方法或......
(1)
render() {
return (
<Theme variables={{ 'primaryColor': 'red' }}>
<Button />
<SecondButton />
<ThirdButton />
</Theme>
);
}
Run Code Online (Sandbox Code Playgroud)
(2)
render() {
return (
<div>
<Button />
<SecondButton />
<ThirdButton />
</div>
);
}
export default Theme(SampleComponent)
Run Code Online (Sandbox Code Playgroud)
显然,这种方法可以明确地传递给每个组件:
render() {
return (
<div>
<Button variables={{ 'primaryColor': 'red' }} />
<SecondButton variables={{ 'primaryColor': 'red' }} />
<ThirdButton variables={{ 'primaryColor': 'red' }} />
</div>
);
}
Run Code Online (Sandbox Code Playgroud) 我很好奇,我已经在中间件中看到过,例如redux-promise-middleware我们希望单个动作触发多个动作(例如REQUEST,SUCCESS,FAILURE)。但是,在中间件中,我们提供了dispatch能够执行dispatch这些操作的。是否有理由next(action)通过dispatch(action)?调用这些其他操作?
我已经使用WebGL1一段时间了,但是现在我对WebGL2有了更多的了解,我对Vertex Array实际的工作感到困惑。例如,在下面的示例中,我可以删除对其的所有引用(例如,创建,绑定,删除),并且该示例继续运行。
我想确保构造函数在用Sinon实例化时正在调用一个方法,但是,我似乎无法使它正常工作,因为我相信sinon不会监视正确的实例化:
class Test {
constructor() {
this.someFunction();
}
someFunction() {
return 1;
}
}
Run Code Online (Sandbox Code Playgroud)
...和测试
describe('constructor', () => {
it('should call someFunction()', () => {
const spyFunc = new Spy(new Test(), 'someFunction');
expect(spyFunc.calledOnce).to.be.true;
});
});
Run Code Online (Sandbox Code Playgroud) 我一直在阅读这些示例的源代码,我继续看到这个选项,但是,我无法在任何地方找到这是否是受支持的功能。你只是antialias通过打开这个标志来获得吗?有关此功能的更多详细信息?
随着我对 WebGL2 的了解越来越多,我在着色器中遇到了这种新语法,您可以通过以下方式在着色器中设置location:layout (location=0) in vec4 a_Position;。这attribute与使用传统gl.getAttribLocation('a_Position');. 我认为它更快?还有其他原因吗?另外,将位置设置为整数会更好还是也可以使用字符串?
opengl-es ×3
reactjs ×3
webgl ×3
webgl2 ×3
redux ×2
css ×1
css-modules ×1
heroku ×1
javascript ×1
mocha.js ×1
postgresql ×1
sinon ×1
sql ×1
unit-testing ×1
webpack ×1