2016-03-22 25 views
0

Ben benim package.json aşağıdaki komut dosyası kullanarak benim sassnode-sass ile derlemek çalışıyorum:Düğüm/npm: düğüm-sass ile SCSS derlerken Dosya bulunamadı import etmek

"node-sass": "node-sass --output-style compressed 'src/scss/styles.scss' 'dist/css/bundle.min.css'", 

Benim styles.scss:

"formatted": "Error: File to import not found or unreadable: bourbon\n  Parent style sheet: /Users/deangibson/Desktop/personal_site/src/scss/styles.scss\n  on line 1 of src/scss/styles.scss\n>> @import \"bourbon\";\n ^\n", 
    "message": "File to import not found or unreadable: bourbon\nParent style sheet: /Users/deangibson/Desktop/personal_site/src/scss/styles.scss", 
    "column": 1, 
    "line": 1, 
    "file": "/Users/deangibson/Desktop/personal_site/src/scss/styles.scss", 
    "status": 1 
} 
: Ben npm run node-sass çalıştırdığınızda
@import "bourbon"; 
@import "neat"; 

body {background: red;} 

Ama aşağıdaki hatayı alıyorum

Projem yapısı aşağıdaki gibidir:

enter image description here

sadece otomatik düğüm bu bağımlılıkları söz konusu olduğunda node_modules kontrol gerekmez mi? Burada ne yapıyorum anlamıyorum ...

cevap

3

Evet, noderequire öğelerini node_modules adresinin dosyalarında otomatik olarak arar. Ancak bir komut satırı uygulaması node-sass yürütüyorsunuz ve bunu yapmaz.

Böyle --include-pathnode-sass için komut satırı uygulamasını sağlayabilir Eğer arrays exported by the bourbon modules when you require them birleştirerek kurulum includePath yapabilirsiniz render JavaScript file that is executed with node yazarsanız

node-sass 
    --output-style compressed 
    --include-path node_modules/bourbon/app/assets/stylesheets/ 
    --include-path node_modules/bourbon-neat/app/assets/stylesheets/ 
    'src/scss/styles.scss' 
    'dist/css/bundle.min.css' 

(okunabilmesi için çok satırlı, package.json tek hat üzerinde olması gerekir) .