Search code examples
phpgulplaravel-elixir

Importing fonts in a Laravel Elixr gulpfile


I was watching the tutorial on Laracasts on Elixr and Gulpfiles (https://laracasts.com/series/laravel-5-fundamentals/episodes/19). so far I am able to compile the web designer's CSS into a minified version. However, his fonts don't appear to render correctly. I did some research on this and found this (https://www.npmjs.com/package/laravel-elixir-fonts) page and was able to install the font manager. However, I am confused about mixing kmy fonts via the gulpfile. I tried copying and pasting the mix.fonts syntax from that page, but run into an SyntaxError: Unexpected token ] when running gulp in my command line. I am new to Laravel elixr and very confused. I was able to figure out how to import my CSS using Elixr but fonts are another issue. Any help is appreciated.

i am trying to import tff files into my CSS and i already know the Laravel does not dusplay assets without using Facades/special syntax. I am really confused by this and like I said I am new to Laravel Elixr. I literally watched the Laracasts video yesterday and understood the basics. I want to import a tff font file into my gulpfile, and any help is appreciated.

gulpfile.js

    /*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */var elixir = require('laravel-elixir');

require('laravel-elixir-fonts');

elixir(function(mix) {
    mix.sass('stylesheet.scss');

});

Solution

  • For this i don't use an external library, but just this

    elixir(function(mix) {
        mix.copy(
            '../../bower_components/font-awesome/fonts',
            'public/build/fonts'
        );
    });