我有一个现有项目,我正在尝试将CSS切换到Sass但是很难开始工作。我按照教程here进行操作,但是当我尝试在我的项目中模仿它时,它无效。在命令提示符中,我有c:\ main \ sub \ working \ compass watch(这是罗盘正在观看的地方)。在我的config.rb文件(../working/sass)中,我有:
const localStore = createStore(
(state = [], obj) => (obj ? { errorMessage: obj.error } : state),
{ errorMessage: null },
);
const inputWithStore = ({ error }) => {
let style = styles.input;
const onChange = (val) => {
if (val === 'test') localStore.dispatch({ type: 'unused', error: null });
else localStore.dispatch({ type: 'unused', error: 'test required' });
};
if (error) {
style = styles.inputError;
}
return (
<TextInput
style={style}
onChangeText={onChange}
/>
);
};
const mapStateToProps = (state) => ({ error: state.errorMessage });
const InputWithStore = connect(mapStateToProps)(inputWithStore);
const Input = () =>
(
<Provider store={localStore}>
<InputWithStore />
</Provider>
);
所以我在测试文件夹中的sass文件夹和style.css中有test.scss。指南针似乎没有找到更改,所以我确定我的设置有误,但无法弄清楚如何更改它们。
文件夹结构:
# Require any additional compass plugins here.
#Folder settings
relative_assets = true #because we're not working from the root
project_path = "c:\main\sub\working\"
css_dir = "../test" #where the CSS will saved
sass_dir = "../sass" #where our .scss files are
# You can select your preferred output style here (can be overridden via the command line):
output_style = :expanded # After dev :compressed
# To disable debugging comments that display the original location of your selectors. Uncomment:
line_comments = true
# Obviously
preferred_syntax = :scss
答案 0 :(得分:1)
您声明自己正在运行c:\main\sub\working\compass watch
,需要cd
进入config.rb
所在的目录并运行compass watch
cd c:\main\sub\working\sass
compass watch