В Фениксе это можно сделать так:
Вам нужно включить пакет sass-brunch в файл package.json и запустить npm-install, например.
{
"repository": {
},
"dependencies": {
"brunch": "^1.8.5",
"babel-brunch": "^5.1.1",
"clean-css-brunch": ">= 1.0 < 1.8",
"css-brunch": ">= 1.0 < 1.8",
"javascript-brunch": ">= 1.0 < 1.8",
"sass-brunch": "^1.8.10",
"uglify-js-brunch": ">= 1.0 < 1.8"
}
}
Теперь вы измените файл app.css, расположенный в файле web/static/css/app.css, на app.scss. Отсюда импортируйте все ваши файлы css/sass (я лично добавляю bootstrap в папку поставщика в css web/static/vendor/css/bootstrap.scss), например.
@import "../vendor/css/bootstrap";
Эта следующая часть может быть той частью, которую вам было трудно понять, так как я =o). То, что вы делаете с файлами javascript, требует их в вашем файле brunch-config.js следующим образом:
exports.config = {
// See http://brunch.io/#documentation for docs.
files: {
javascripts: {
joinTo: "js/app.js",
order: {
before: [
"web/static/vendor/js/jquery.min.js",
"web/static/vendor/js/bootstrap.min.js",
"web/static/vendor/js/scripts.js"
]
}
},
stylesheets: {
joinTo: "css/app.css"
},
templates: {
joinTo: "js/app.js"
}
},
conventions: {
// This option sets where we should place non-css and non-js assets in.
// By default, we set this to "/web/static/assets". Files in this directory
// will be copied to `paths.public`, which is "priv/static" by default.
assets: /^(web\/static\/assets)/
},
// Phoenix paths configuration
paths: {
// Dependencies and current project directories to watch
watched: [
"deps/phoenix/web/static",
"deps/phoenix_html/web/static",
"web/static",
"test/static"
],
// Where to compile files to
public: "priv/static"
},
// Configure your plugins
plugins: {
babel: {
// Do not use ES6 compiler in vendor code
ignore: [/web\/static\/vendor/]
}
},
modules: {
autoRequire: {
"js/app.js": ["web/static/js/app"]
}
},
npm: {
enabled: true
}
};
person
Donovan Dikaio
schedule
08.12.2015