我按照AngularJS with Laravel 5 using NPM中提供的一个答案但是我无法使用Gulp成功编译lumx的SCSS文件。
任何人都知道如何解决这个问题?
我的app.scss包含:
@import "../../../bower_components/mdi/scss/materialdesignicons";
@import "../../../bower_components/lumx/dist/scss/lumx";
运行gulp之后,我收到了这个错误:
gulp-notify: [Laravel Elixir] Sass Compilation Failed: bower_components\lumx\dist\scss\_lumx.scss
Error: File to import not found or unreadable: bourbon
Parent style sheet: D:/laragon1.0.6/www/task-manager/bower_components/lumx/dist/scss/_lumx.scss
on line 5 of bower_components/lumx/dist/scss/_lumx.scss
>> @import "bourbon";
_lumx.scss文件包含
@import "bourbon";
@import "materialdesignicons";
@import "settings/colors";
@import "settings/defaults";
@import "settings/responsive";
我的bower_components文件夹位于Laravel应用程序的根文件夹中。 所有javascript文件都适用于Elixir任务,但只有scss文件存在问题。
答案 0 :(得分:2)
我可以将lumx与laravel集成。
进入项目文件夹
npm install
bower init
bower install lumx --save
elixir((mix) => {
//mix.sass('app.scss');
//mix.webpack('app.js');
mix.styles('./bower_components/lumx/dist/lumx.css');
mix.styles('./bower_components/mdi/css/materialdesignicons.css');
mix.scripts('./bower_components/jquery/dist/jquery.js');
mix.scripts('./bower_components/velocity/velocity.js');
mix.scripts('./bower_components/moment/min/moment-with-locales.js');
mix.scripts('./bower_components/angular/angular.js');
mix.scripts('./bower_components/lumx/dist/lumx.js');
mix.copy('./bower_components/mdi/fonts', 'public/fonts');
});

<!DOCTYPE html>
<html lang="en" ng-app = "myModule">
<head>
<meta charset="UTF-8">
<title>Laravel Lumx</title>
<link rel="stylesheet" href="{{ asset('css/lumx.css') }}">
<link rel="stylesheet" href="{{ asset('css/materialdesignicons.css') }}">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
</head>
<body>
<div class="p+">
Hello
</div>
<div class="p+">
<lx-button lx-type="raised">Button</lx-button>
<lx-button lx-type="flat">Button</lx-button>
<lx-button lx-type="fab"><i class="mdi mdi-plus"></i></lx-button>
<lx-button lx-type="icon"><i class="mdi mdi-plus"></i></lx-button>
</div>
<div class="p+">
<lx-switch ng-model="vm.switches.colors.blue" lx-color="blue">Blue switch</lx-switch>
<lx-switch ng-model="vm.switches.colors.green" lx-color="green" class="mt+">Green switch</lx-switch>
<lx-switch ng-model="vm.switches.colors.orange" lx-color="orange" class="mt+">Orange switch</lx-switch>
<lx-switch ng-model="vm.switches.colors.red" lx-color="red" class="mt+">Red switch</lx-switch>
</div>
<script src="{{ asset('js/jquery.js') }}"></script>
<script src="{{ asset('js/velocity.js') }}"></script>
<script src="{{ asset('js/moment-with-locales.js') }}"></script>
<script src="{{ asset('js/angular.js') }}"></script>
<script src="{{ asset('js/lumx.js') }}"></script>
<script>
angular.module('myModule', ['lumx']);
</script>
</body>
</html>
&#13;
Route::get('/', function () {
return view('test');
});
&#13;
现在运行gulp命令并在浏览器中打开项目,您可以看到this
您可以将所有js和ccs分组到一个文件中
配置gulpfile.js
elixir((mix) => {
//mix.sass('app.scss');
//mix.webpack('app.js');
mix.styles([
'./bower_components/lumx/dist/lumx.css',
'./bower_components/mdi/css/materialdesignicons.css'
], 'public/css/lumxall.css');
mix.scripts([
'./bower_components/jquery/dist/jquery.js',
'./bower_components/velocity/velocity.js',
'./bower_components/moment/min/moment-with-locales.js',
'./bower_components/angular/angular.js',
'./bower_components/lumx/dist/lumx.js'
], 'public/js/lumxall.js');
mix.copy('./bower_components/mdi/fonts', 'public/fonts');
});
&#13;
<!DOCTYPE html>
<html lang="en" ng-app = "myModule">
<head>
<meta charset="UTF-8">
<title>Laravel Lumx</title>
<link rel="stylesheet" href="{{ asset('css/lumxall.css') }}">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
</head>
<body>
<div class="p+">
Hola
</div>
<div class="p+">
<lx-button lx-type="raised">Button</lx-button>
<lx-button lx-type="flat">Button</lx-button>
<lx-button lx-type="fab"><i class="mdi mdi-plus"></i></lx-button>
<lx-button lx-type="icon"><i class="mdi mdi-plus"></i></lx-button>
</div>
<div class="p+">
<lx-switch ng-model="vm.switches.colors.blue" lx-color="blue">Blue switch</lx-switch>
<lx-switch ng-model="vm.switches.colors.green" lx-color="green" class="mt+">Green switch</lx-switch>
<lx-switch ng-model="vm.switches.colors.orange" lx-color="orange" class="mt+">Orange switch</lx-switch>
<lx-switch ng-model="vm.switches.colors.red" lx-color="red" class="mt+">Red switch</lx-switch>
</div>
<script src="{{ asset('js/lumxall.js') }}"></script>
<script>
angular.module('myModule', ['lumx']);
</script>
</body>
</html>
&#13;
再次运行命令gulp
对于角材料,材料设计精简版,Bootstrap材料设计和其他框架,这是有效的
源代码位于Github
请原谅我的英文