grunt-contrib-less icon indicating copy to clipboard operation
grunt-contrib-less copied to clipboard

no output files when using with grunt-webfont, grunt-ttf2woff, grunt-ttf2eot and grunt-fontface

Open goodpixels opened this issue 9 years ago • 0 comments

i am trying to generate the icon font as well as convert some *.ttf files on the fly, then compile CSS using your plugin. here are my tasks:

grunt.registerTask( 'icons', [ 'webfont' ] );
grunt.registerTask( 'fonts', [ 'ttf2woff', 'ttf2eot', 'fontface' ] );

grunt.registerTask( 'default',  [

    'clean',
    'icons',
    'fonts',
    'less:dev',
    'concat',
    'copy',
    'watch'

] );

and here's my config:

// Icons

webfont: {

    options: {

        engine:         '<%= project.settings.iconEngine %>',
        htmlDemo:       false,
        stylesheet:     'less',
        template:       '<%= project.paths.icons %>/template.css',
        templateOptions: { classPrefix: '<%= project.settings.iconPrefix %>' },

    },

    icons: {

        src:        '<%= project.paths.icons %>/*.svg',
        dest:       '<%= project.paths.fonts %>/icons',
        destCss:    '<%= project.paths.less %>',

    },

},

// Fonts

ttf2woff: {

    montserrat: {

        src:    [ '<%= project.paths.fonts %>/montserrat/*.ttf' ],
        dest:   '<%= project.paths.fonts %>',

    }

},

ttf2eot: {

    montserrat: {

        src:    [ '<%= project.paths.fonts %>/montserrat/*.ttf' ],
        dest:   '<%= project.paths.fonts %>',

    }

},

fontface: {

    montserrat: {

        options: {

            fontDir:    '<%= project.paths.fonts %>/montserrat',
            template:   "@font-face {" +

                            "font-family: '{{font}}';" +
                            "src: url( '../fonts/{{font}}.eot?#iefix' ) format( 'embedded-opentype' )," +
                            "url( '../fonts/{{font}}.woff' ) format( 'woff' );" +

                        "}",
            outputFile: '<%= project.paths.less %>/font-montserrat.less',

        }

    }

},

// LESS

less: {

    dev: {

        options: {

            paths:              [ '<%= project.paths.less %>' ],
            sourceMap:          true,
            sourceMapFilename:  '<%= project.paths.css %>/style.css.map',
            sourceMapURL:       'style.css.map',
            sourceMapRootpath:  '../../',


        },

        files: {

            '<%= project.paths.css %>/ie.css': [ '<%= project.paths.less %>/ie.less' ],
            '<%= project.paths.css %>/style.css': [ '<%= project.paths.less %>/style.less' ],

        }


    },

}

the problem is, that when i run grunt default it generates the icon font and converts *.ttf nicely, but fails to create style.css. interestingly, the ie.css file is being created and no errors are being thrown.

i tried many things: compiling only one file - ie.less and then separately style.less - and i get the same result: the first one is being generated without any problems, the other one does not exist.

i also tried generating different fonts, but that did not change anything.

i tried disabling source maps - still, no effect.

when i run grunt all -v, here's what i get:

Running "icons" task

Running "webfont" task

Running "webfont:icons" (webfont) task
Verifying property webfont.icons exists in config...OK
Files: assets/icons/close.svg, assets/icons/download.svg, assets/icons/facebook.svg, assets/icons/reset.svg, assets/icons/resize.svg, assets/icons/rotate.svg, assets/icons/sort.svg, assets/icons/sun.svg, assets/icons/twitter.svg -> assets/fonts/icons
Verifying property webfont.icons.src exists in config...OK
Verifying property webfont.icons.dest exists in config...OK
Options: engine="fontforge", htmlDemo=false, stylesheet="less", template="assets/icons/template.css", templateOptions={"classPrefix":"icon-"}
New hash: 703158c9d4ce016076447659be6b3397 - previous hash: 703158c9d4ce016076447659be6b3397
Config and source files weren’t changed since last run, checking resulting files...
fontforge: Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors.
fontforge:  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
fontforge:  with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
fontforge:  Based on sources from 20:30 GMT 31-Dec-2014-D.
fontforge:  Based on source from git with hash: 
fontforge: 
Font icons with 9 glyphs created.

Running "fonts" task

Running "ttf2woff" task

Running "ttf2woff:montserrat" (ttf2woff) task
Verifying property ttf2woff.montserrat exists in config...OK
Files: assets/fonts/montserrat/Montserrat-Black.ttf, assets/fonts/montserrat/Montserrat-Bold.ttf, assets/fonts/montserrat/Montserrat-Light.ttf, assets/fonts/montserrat/Montserrat-Regular.ttf, assets/fonts/montserrat/Montserrat-Thin.ttf -> assets/fonts
Verifying property ttf2woff.montserrat.src exists in config...OK
Verifying property ttf2woff.montserrat.dest exists in config...OK
Reading assets/fonts/montserrat/Montserrat-Black.ttf...OK
Writing assets/fonts/Montserrat-Black.woff...OK
>> Created "assets/fonts/Montserrat-Black.woff" from "assets/fonts/montserrat/Montserrat-Black.ttf"
Reading assets/fonts/montserrat/Montserrat-Bold.ttf...OK
Writing assets/fonts/Montserrat-Bold.woff...OK
>> Created "assets/fonts/Montserrat-Bold.woff" from "assets/fonts/montserrat/Montserrat-Bold.ttf"
Reading assets/fonts/montserrat/Montserrat-Light.ttf...OK
Writing assets/fonts/Montserrat-Light.woff...OK
>> Created "assets/fonts/Montserrat-Light.woff" from "assets/fonts/montserrat/Montserrat-Light.ttf"
Reading assets/fonts/montserrat/Montserrat-Regular.ttf...OK
Writing assets/fonts/Montserrat-Regular.woff...OK
>> Created "assets/fonts/Montserrat-Regular.woff" from "assets/fonts/montserrat/Montserrat-Regular.ttf"
Reading assets/fonts/montserrat/Montserrat-Thin.ttf...OK
Writing assets/fonts/Montserrat-Thin.woff...OK
>> Created "assets/fonts/Montserrat-Thin.woff" from "assets/fonts/montserrat/Montserrat-Thin.ttf"

Running "ttf2eot" task

Running "ttf2eot:montserrat" (ttf2eot) task
Verifying property ttf2eot.montserrat exists in config...OK
Files: assets/fonts/montserrat/Montserrat-Black.ttf, assets/fonts/montserrat/Montserrat-Bold.ttf, assets/fonts/montserrat/Montserrat-Light.ttf, assets/fonts/montserrat/Montserrat-Regular.ttf, assets/fonts/montserrat/Montserrat-Thin.ttf -> assets/fonts
Verifying property ttf2eot.montserrat.src exists in config...OK
Verifying property ttf2eot.montserrat.dest exists in config...OK
Reading assets/fonts/montserrat/Montserrat-Black.ttf...OK
Writing assets/fonts/Montserrat-Black.eot...OK
>> Created "assets/fonts/Montserrat-Black.eot" from "assets/fonts/montserrat/Montserrat-Black.ttf"
Reading assets/fonts/montserrat/Montserrat-Bold.ttf...OK
Writing assets/fonts/Montserrat-Bold.eot...OK
>> Created "assets/fonts/Montserrat-Bold.eot" from "assets/fonts/montserrat/Montserrat-Bold.ttf"
Reading assets/fonts/montserrat/Montserrat-Light.ttf...OK
Writing assets/fonts/Montserrat-Light.eot...OK
>> Created "assets/fonts/Montserrat-Light.eot" from "assets/fonts/montserrat/Montserrat-Light.ttf"
Reading assets/fonts/montserrat/Montserrat-Regular.ttf...OK
Writing assets/fonts/Montserrat-Regular.eot...OK
>> Created "assets/fonts/Montserrat-Regular.eot" from "assets/fonts/montserrat/Montserrat-Regular.ttf"
Reading assets/fonts/montserrat/Montserrat-Thin.ttf...OK
Writing assets/fonts/Montserrat-Thin.eot...OK
>> Created "assets/fonts/Montserrat-Thin.eot" from "assets/fonts/montserrat/Montserrat-Thin.ttf"

Running "fontface" task

Running "fontface:montserrat" (fontface) task
Verifying property fontface.montserrat exists in config...OK
File: [no files]
Options: fontDir="assets/fonts/montserrat", outputFile="assets/less/font-montserrat.less", removeFromFile="-webfont", template="@font-face {font-family: '{{font}}';src: url( '../fonts/{{font}}.eot?#iefix' ) format( 'embedded-opentype' ),url( '../fonts/{{font}}.woff' ) format( 'woff' );}"
Writing assets/less/font-montserrat.less...OK

Running "less:dev" (less) task
Verifying property less.dev exists in config...OK
Files: assets/less/ie.less -> assets/css/ie.css
Files: assets/less/style.less -> assets/css/style.css
Options: banner="", paths=["assets/less"], sourceMap, sourceMapFilename="assets/css/style.css.map", sourceMapURL="style.css.map", sourceMapRootpath="../../"
Reading assets/less/ie.less...OK

the only way around this problem is to isolate icons and font tasks from the LESS task, like so:

grunt.registerTask( 'generate', [

    'icons',
    'fonts',

] );

grunt.registerTask( 'default',  [

    'less:dev',
    'concat',
    'copy',
    'watch',

] );

but this doesn't really help, because i have to run TWO commands. also placing generate inside the default task gives the same behaviour. any ideas why this might be happening?

goodpixels avatar May 07 '15 21:05 goodpixels