gruntjs / grunt-contrib-connect

Start a static web server.
http://gruntjs.com
MIT License
714 stars 145 forks source link

Connect serve css/js files to XAMPP website. #137

Closed codeengie closed 10 years ago

codeengie commented 10 years ago

Is it possible to serve css or js files to XAMPP using connect? I've used Yeoman in the past and I love the way they use connect to serve .tmp and bower components. Here's the yeoman code for reference:

connect: {
    options: {
        port: 9000,
        open: true,
        livereload: 35729,
        hostname: 'localhost'
    },
    livereload: {
        options: {
            middleware: function(connect) {
                return [
                    connect.static('.tmp'),
                    connect().use('/bower_components', connect.static('./bower_components')),
                    connect.static('app')
                ]
        }
    }
}

This works fine with HTML websites but unfortunately this particular project I'm working on uses PHP. I've dropped the website folder into the htdocs folder of my XAMPP and I can view PHP pages fine in my browser using this URL http://localhost/myphpwebsite. I've integrated Grunt into this website and I know I can easily make a few changes to my Grunt config to place my css and js in other directories but I want to know if this is possible with connect to serve the compiled files I place in my .tmp directory. I've searched on the net and found a connect version that create a php server and I've also looked into grunt-connect-proxy. But have not had any luck. Sorry if this is a noob question I'm still trying to learn about connect and its uses any help would be greatly appreciated. Here is my folder structure:

myphpwebsite
    /app
        /scripts
        /styles
        /images
        index.php
    /node_modules
    /bower_components
    /.tmp
    .gitignore
    .jshintrc
    Gruntfile.js
    package.json
    README.md

Thanks.

sindresorhus commented 10 years ago

Support questions are better asked on StackOverflow: http://stackoverflow.com/questions/tagged/gruntjs Paste in the link to the question here so others can follow ;)