简体   繁体   中英

How can I set up Yeoman/Grunt to run PHP?

I've just started using Yeoman (with the webapp generator) and Grunt and I've got a project scaffolded the way I want aside from being able to run PHP. I started out running grunt-serve but there's no out-of-the box support for PHP. I then switched to "grunt watch" and ran Apache, but then my page's CSS isn't processed. I can only see the styling when running grunt-serve (why is this?). Is there a standard workflow for PHP development w/ Grunt? I've searched around for this quite a bit and couldn't find any solutions. Any help would be much appreciated.

with "grunt server" you mean grunt-serve or grunt-contrib-connect ?

if so, just replace that plugin with the grunt-php -plugin:

grunt.initConfig({
    php: {
        test: {
            options: {
                keepalive: true,
                open: true
            }
        }
    }
});

to get a really good answer you need to tell which yeoman-generator you used, what you changed there, how you want your css and js to be processed, and so on.

be aware that grunt itself isnt some sort of server or anything like that, it's just a modular build tool written on top of node.js.

Don't think you can, grunt is based on NodeJs which is javascript. You would need to run a server with php to get php.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM