问题描述:

I'm currently working on a SASS library which is a long list of partials imported into 1 file.

The file structure is as following:

css-directory

├── functions

│ ├── _px2em.scss

│ └── _unitless.scss

├── helpers

│ ├── _align.scss

│ ├── _clearfix.scss

│ ├── _float.scss

│ ├── _hidden.scss

│ ├── _invisible.scss

│ ├── _ir.scss

│ └── _visuallyhidden.scss

├── layout

│ ├── _blockquote.scss

│ ├── _button.scss

│ ├── _fixed-footer.scss

│ ├── _form.scss

│ ├── _list.scss

│ ├── _loading.scss

│ ├── _triangle.scss

│ └── _truncate.scss

├── modules

│ ├── _grid.scss

│ └── _normalize.scss

├── prefixes

│ ├── _animation-delay.scss

│ ├── _animation.scss

│ ├── _background-clip.scss

│ ├── _borderbox.scss

│ ├── _border-radius.scss

│ ├── _box-shadow.scss

│ ├── _box-sizing.scss

│ ├── _flex.scss

│ ├── _font-face.scss

│ ├── _gradient.scss

│ ├── _hyphens.scss

│ ├── _keyframes.scss

│ ├── _transform-origin.scss

│ ├── _transform.scss

│ ├── _transition.scss

│ └── _user-select.scss

└── _verepo.scss

and the _verepo.scss file imports all the other partials.

I'd like to be able to concatenate _verepo.scss and it's partials into 1 .scss file so that I can then distribute it easily.

网友答案:

Found a solution, by using grunt and grunt-contrib-concat.

Fixed it with the following code block inside of grunt's initConfig:

concat: {
        options: {
                banner: '/*! veRepo.scss v%VERSION% | MIT License | https://github.com/varemenos/verepo */\n\n'
        },
        dist: {
                src: [
                        'src/functions/_**.scss',
                        'src/prefixes/_**.scss',
                        'src/helpers/_**.scss',
                        'src/layout/_**.scss',
                        'src/modules/_**.scss',
                ],
                dest: '_verepo.scss'
        }
}
相关阅读:
Top