用于SCSS的Nanoc滤波器

时间:2016-08-31 11:32:50

标签: css ruby nanoc

我正在使用nanoc和ruby编写网站,我想使用SCSS。但我有点问题。无论我尝试什么,我都无法将我的SCSS文件转换为输出并作为编译的CSS输出。它会抛出错误或以完全相同的文件类型出现。我的Ruby规则文件和目录结构如下,请帮忙!

#!/usr/bin/env ruby

compile '/**/*.html' do
  layout '/default.*'
end

# This is an example rule that matches Markdown (.md) files, and filters them
# using the :kramdown filter. It is commented out by default, because kramdown
# is not bundled with Nanoc or Ruby.
#
#compile '/**/*.md' do
#  filter :kramdown
#  layout '/default.*'
#end

route '/**/*.{html,md}' do
  if item.identifier =~ '/index.*'
    '/index.html'
  else
    item.identifier.without_ext + '/index.html'
  end
end

compile '/assets/SCSS/' do
  filter :scss => :css
  write @item.identifier.without_ext + '.css'
 end

compile '/assets/images/*' do
  write item.identifier.to_s
end

compile '/**/*' do
  write item.identifier.to_s
end

layout '/**/*', :erb

这是我的目录结构:

root
|
|\_content
|  |
|   \_assets
|     |
|      \_test.scss
\_public
  |
   \_assets
     |
      \_test.scss <-------- This should be compiled CSS

2 个答案:

答案 0 :(得分:1)

我找到了一个名为Compass的实用程序,它为您提供SCSS的过滤器选项。

答案 1 :(得分:0)

使用How can I get the nanoc SASS filter to use SCSS syntax?

中概述的SASS过滤器
    CheckBox ch1;
    Button btnSubmit;
    int checked=0;
    DatabaseHelper dbhelper;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ch1=(CheckBox)findViewById(R.id.checkBox);
    btnSubmit=(Button)findViewById(R.id.button);

    AddData();
    }

    public void AddData() {
    btnSubmit.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            ch1.setOnCheckedChangeListener(new 
      CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, 
         boolean isChecked) {
                    if(isChecked){
                        checked = 1;
                    }else{
                        checked = 0;
                    }
                }
            });


            boolean insertData = dbhelper.addData(checked);

            if (insertData == true) {
                Toast.makeText(MainActivity.this, "Order Placed!", 
       Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(MainActivity.this, "Something went wrong : 
      (.", Toast.LENGTH_LONG).show();
            }
        }
    });
}
相关问题