Answer the question
In order to leave comments, you need to log in
How to import compass gem features into Webpacker?
The first Vue component to be screwed into an existing rail app. I've run into a lot of problems, here's one of them. You need to style the component in the sass style language using variables and mixins from the non-webpacker stylesheets used in the application. And it seems that importing such a file does not cause any special problems, except for the use of sprites. I am using jam 'compass-rails', '3.1.0'. This gives me the right to write sprockets-friendly imports: @import 'compass/reset'
and other imports available in this jam. But webpacker does not understand this construction:
Module build failed:
@import 'compass/reset'
^
File to import not found or unreadable: compass/reset
<template lang="haml">
%div
#video-help
%p Для добавления видео с youtube.com выполните следующие действия:
%ul.marker-list
%li Загрузите Ваше видео на сервис youtube.
%li Видео должно быть публичным.
%li Скопируйте ID видео (либо ссылку на видео).
%li Добавьте видео к объявлению, указав ID видео (либо ссылку на видео).
%p{'d-data': 'df'} Привет, {{title2}}
</template>
<script lang="coffee">
export default
props: ['title2']
data: ()->
return data: {}
</script>
<style scoped lang="sass">
@import '../../../../assets/stylesheets/styles.sass'
#video-help
@mixin compass-mixin
color: blue
</style>
module.exports = {
// ...
module: {
loaders: [
/* some other loaders */
{
test: /\.scss$/,
loader: 'style!css!ruby-sass?compass=1'
}
]
}
};
module.exports = {
test: /\.scss$/,
loader: 'style!css!ruby-sass?compass=1'
};
const { environment } = require('@rails/webpacker')
const coffee = require('./loaders/coffee')
const vue = require('./loaders/vue')
const compass = require('./loaders/compass')
environment.loaders.append('vue', vue)
environment.config.resolve.alias = { 'vue$': 'vue/dist/vue.esm.js' }
environment.loaders.append('coffee', coffee)
environment.loaders.append('compass', compass)
module.exports = environment
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question