<tfoot id='Wo2fo'></tfoot>
    <legend id='Wo2fo'><style id='Wo2fo'><dir id='Wo2fo'><q id='Wo2fo'></q></dir></style></legend>

      1. <i id='Wo2fo'><tr id='Wo2fo'><dt id='Wo2fo'><q id='Wo2fo'><span id='Wo2fo'><b id='Wo2fo'><form id='Wo2fo'><ins id='Wo2fo'></ins><ul id='Wo2fo'></ul><sub id='Wo2fo'></sub></form><legend id='Wo2fo'></legend><bdo id='Wo2fo'><pre id='Wo2fo'><center id='Wo2fo'></center></pre></bdo></b><th id='Wo2fo'></th></span></q></dt></tr></i><div id='Wo2fo'><tfoot id='Wo2fo'></tfoot><dl id='Wo2fo'><fieldset id='Wo2fo'></fieldset></dl></div>

        <small id='Wo2fo'></small><noframes id='Wo2fo'>

          <bdo id='Wo2fo'></bdo><ul id='Wo2fo'></ul>

        运行 BrowserSync 和 PHP 的 Gulp-webapp

        Gulp-webapp running BrowserSync and PHP(运行 BrowserSync 和 PHP 的 Gulp-webapp)
        <legend id='vMeAy'><style id='vMeAy'><dir id='vMeAy'><q id='vMeAy'></q></dir></style></legend>
          <bdo id='vMeAy'></bdo><ul id='vMeAy'></ul>

              <tbody id='vMeAy'></tbody>
          1. <tfoot id='vMeAy'></tfoot>

                <small id='vMeAy'></small><noframes id='vMeAy'>

              1. <i id='vMeAy'><tr id='vMeAy'><dt id='vMeAy'><q id='vMeAy'><span id='vMeAy'><b id='vMeAy'><form id='vMeAy'><ins id='vMeAy'></ins><ul id='vMeAy'></ul><sub id='vMeAy'></sub></form><legend id='vMeAy'></legend><bdo id='vMeAy'><pre id='vMeAy'><center id='vMeAy'></center></pre></bdo></b><th id='vMeAy'></th></span></q></dt></tr></i><div id='vMeAy'><tfoot id='vMeAy'></tfoot><dl id='vMeAy'><fieldset id='vMeAy'></fieldset></dl></div>

                  本文介绍了运行 BrowserSync 和 PHP 的 Gulp-webapp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的主要目标是调整 Yeoman 的 gulp-webapp 开发工作流程来运行 PHP.

                  My main goal here is to adapt Yeoman's gulp-webapp development workflow to run PHP.

                  具体来说,我希望能够将 gulp-php-connect多个基本目录(用于从 Sass 编译的 CSS)和 路由 一起使用strong>(对于 Bower 依赖项),如果可能的话.

                  Specifically, I want to be able to use gulp-php-connect with multiple base directories (for the compiled CSS from Sass) and routes (for Bower dependencies), if that's even possible.

                  我可以使用 gulp-connect-php 插件通过 Gulp 运行 PHP,例如这个:

                  I'm able to run PHP with Gulp using the gulp-connect-php plugin, like this:

                  gulp.task('connect-php', function() {
                    connectPHP.server({
                      hostname: '0.0.0.0',
                      bin: '/Applications/MAMP/bin/php/php5.5.3/bin/php',
                      ini: '/Applications/MAMP/bin/php/php5.5.3/conf/php.ini',
                      port: 8000,
                      base: 'dev'
                    });
                  });
                  

                  但是,我想利用 gulp-webapp 出色但非常复杂的开发工作流架构,它依赖 BrowserSync、Sass 编译器(编译为 .css 文件到 .tmp 文件夹中,用于开发)、自动前缀,并使用了许多其他有用的插件.

                  However, I'd like to take advantage of gulp-webapp's excellent but quite entangled development workflow architecture, which relies on BrowserSync, Sass compiler (compiles to a .css file into a .tmp folder, for development), auto-prefixer, and uses a bunch of other useful plugins.

                  这是我想适应使用 gulp-connect-php 或任何其他 PHP 的部分:

                  Here's the part of it that I would like to adapt to use gulp-connect-php or any other PHP :

                  gulp.task('serve',  ['styles'],function () {
                    browserSync({
                      notify: false,
                      port: 9000,
                      server: {
                        baseDir: ['.tmp', 'app'],
                        routes: {
                          '/bower_components': 'bower_components'
                        }
                      }
                    });
                  
                    // watch for changes
                    gulp.watch([
                      'app/*.html',
                      '.tmp/styles/**/*.css',
                      'app/scripts/**/*.js',
                      'app/images/**/*'
                    ]).on('change', reload);
                  
                    gulp.watch('app/styles/**/*.scss', ['styles', reload]);
                    gulp.watch('bower.json', ['wiredep', 'fonts', reload]);
                  });
                  

                  BrowserSync 有一个代理选项,它允许我使用 gulp-connect-php 服务器运行它,这非常棒.但我需要 gulp-connect-php 它来使用多个基本目录和路由,例如 BrowserSync 会.

                  BrowserSync has a proxy option, that allows me to run it with gulp-connect-php server, which is pretty amazing. But I need gulp-connect-php it to use multiple base directories and routes, like BrowserSync does.

                  到目前为止,我想出了这个:

                  So far I've come up with this:

                  gulp.task('serve-php',  ['styles','connect-php'],function () {
                    browserSync({
                      proxy: "localhost:8000"
                    });
                  
                    // watch for changes
                    gulp.watch([
                      'app/*.php',
                      'app/styles/**/*.css',
                      'app/scripts/**/*.js',
                      'app/images/**/*'
                    ]).on('change', reload);
                  
                    gulp.watch('app/styles/**/*.scss', ['styles, reload]);
                    gulp.watch('bower.json', ['wiredep', 'fonts', reload]);
                  });
                  

                  为了临时解决多个基本目录问题,我调整了 styles 任务,以便它将编译后的 .css 存储到 /app 而不是.tmp/.不过,我更喜欢将它放在临时文件夹中,因为我不需要那个已编译的 .css 文件与我的 Sass 文件一起挂在那里.

                  To temporarily fix the multiple base directories issue, I tweaked the styles task so it stores the compiled .css to /app instead of .tmp/. I'd prefer to have it on a temp folder though, because I don't need that compiled .css file hanging around there with my Sass files.

                  对于 routes 问题,我试图告诉 wiredep 插件更改路径,例如,从 bower_components/jquery/dist/jquery.js../bower_components/jquery/dist/jquery.js,没有成功.

                  For the routes issue, I'm trying to tell wiredep plugin to change a path, say, from bower_components/jquery/dist/jquery.js to ../bower_components/jquery/dist/jquery.js, with no success.

                  我所能做的就是手动重命名 index.php 中的路径,但它仍然不起作用.当运行 gulp serve 我得到:

                  All I could do was manually rename the paths in index.php, and it still doesn't work. When running gulp serve I get:

                  /bower_components/jquery/dist/modernizr.js - 没有这样的文件或目录

                  ...即使我将 index.html 中的路径更改为 ../bower_components/jquery/dist/jquery.js.

                  ...even though I changed the path in index.html to ../bower_components/jquery/dist/jquery.js.

                  我认为这不起作用,因为 gulp-connect-php 服务器无法看到基本文件夹之外的内容.

                  I believe that doesn't work because the gulp-connect-php server can't see what's outside the base folder.

                  我正在尝试不同的事情,虽然我对这个线程的标题非常模糊,但我认为最干净的解决方案是使用 gulp-connect-php,但我不知道这是否可能.

                  I'm trying different things, and though I've been pretty vague on this thread's title, I think that the cleanest solution would be to run multiple base directories and routes with gulp-connect-php, but I don't know if that's possible.

                  推荐答案

                  FWIW,我有一个非常简单和公平的解决方案,将编译后的 .css 文件放在 app/根目录中,并将/bower_dependencies 文件夹移动到应用程序/文件夹.

                  FWIW, I've got a quite simple and fair solution for that by placing the compiled .css file in the app/ root and moving /bower_dependencies folder inside the app/ folder.

                  对于 Sass,我只需要将占位符中的路径更改为 并更改 deststyles 任务中的 code>.

                  For Sass, I only needed to change the path in the placeholder to <!-- build:css styles/main.css --> and change the dest in the styles task.

                  对于 bower_components,我只是在 .bowerrc 中编辑了 bower_components:

                  For the bower_components, I just edited bower_components in .bowerrc:

                  {
                    "directory": "app/bower_components"
                  } 
                  

                  并将其添加到 gulpfile.js 中的 wiredep 流中:

                  and added this to the wiredep stream in gulpfile.js:

                    fileTypes: {
                      scss: {
                        replace: {
                          scss: '@import "app/{{filePath}}";'
                        }
                      }
                    },
                  

                  这篇关于运行 BrowserSync 和 PHP 的 Gulp-webapp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  <small id='apNON'></small><noframes id='apNON'>

                    <tbody id='apNON'></tbody>

                    <bdo id='apNON'></bdo><ul id='apNON'></ul>
                  • <tfoot id='apNON'></tfoot>

                    1. <i id='apNON'><tr id='apNON'><dt id='apNON'><q id='apNON'><span id='apNON'><b id='apNON'><form id='apNON'><ins id='apNON'></ins><ul id='apNON'></ul><sub id='apNON'></sub></form><legend id='apNON'></legend><bdo id='apNON'><pre id='apNON'><center id='apNON'></center></pre></bdo></b><th id='apNON'></th></span></q></dt></tr></i><div id='apNON'><tfoot id='apNON'></tfoot><dl id='apNON'><fieldset id='apNON'></fieldset></dl></div>

                          <legend id='apNON'><style id='apNON'><dir id='apNON'><q id='apNON'></q></dir></style></legend>