gulp

What is causing this “invalid top-level expression” error in my GULP gulpfile.js file?

 ̄綄美尐妖づ 提交于 2019-12-08 19:11:03
问题 I get an error after I start gulp. I have taken out all other plugins to find problem: [gulp-sass] source string:1: error: invalid top-level expression gulpfile.js: var gulp = require('gulp'); var sass = require('gulp-sass'); gulp.task('sass', function() { gulp.src('app/assets/sass/styles.sass') .pipe(sass({ errLogToConsole: true })) .pipe(gulp.dest('public_html/assets/css')) }); gulp.task('default', ['sass'], function() { gulp.watch("app/assets/sass/*.sass", ['sass']); }); Windows 7 回答1: If

Using gulp-sass, how do I preserve the folder structure of my sass files except for the immediate parent directory?

十年热恋 提交于 2019-12-08 17:46:31
I have a project with multiple folders that contain sass files: |── src └── scripts └── app1 └── sass └── base.scss └── app2 └── sass └── base.scss I also have a gulp task that compiles those .scss files using gulp-sass and gulp-concat-css : gulp.task('build:sass', () => gulp.src([ 'scripts/**/*.scss' ]) .pipe(plugins.sass().on('error', plugins.sass.logError)) .pipe(plugins.concatCss('bundle.css')) .pipe(gulp.dest('dist')) ); Right now, the above task just creates bundle.css into the dist folder: |── dist └── bundle.css What I'd like to have happen is this, where the initial folder structure

Gulp-inject transform doesn't work

南楼画角 提交于 2019-12-08 17:28:19
问题 I've tried to setup gulp-inject to inject dependencies into index.html. Everything works fine except transform function. I need to replace part of filepath in the following way: /frontend/src/ --> /static/ I've tried to do it like this (copy-pasted from somewhere): transform : function ( filePath, file, i, length ) { var newPath = filePath.replace('/frontend/src', ''); console.log('inject script = '+ newPath); return '<script src="/static/' + newPath + '"></script>'; } After executing, I have

Include a twig file and pass variables from a separate file?

只愿长相守 提交于 2019-12-08 17:07:44
问题 I have container.twig including component.twig and passing an object called 'mock'. In container.twig: {% set mock = { title : "This is my title" } %} {% include 'component.twig' with mock %} This is working fine but I want to move the mock data to its own file. This isnt working: Container.twig {% include 'component.twig' with 'mock.twig' %} In mock.twig {% set mock = { title : "This is my title" } %} Im using gulp-twig but it works like standard twig in most respects. https://github.com

No gulpfile found

本秂侑毒 提交于 2019-12-08 16:57:01
问题 I am new in laravel. I am trying the command nmp install. it does not work. Then as shown in their official documentation, I tried npm install --global gulp-cli but I was getting access denied error. So I gave sudo npm install --global gulp-cli It seemed to give me some correct result. then I gave npm install --no-bin-links but it says that, "npm WARN vagrant@1.0.0 No description npm WARN vagrant@1.0.0 No repository field." I tried npm install -d though the result ended with "ok" (after

How to use SASS for components style in Angular 2?

女生的网名这么多〃 提交于 2019-12-08 16:54:01
问题 In Angular 2 when we define a component we can specify a styleUrls property to the decorator which points to a set of stylesheets to be applied to the component: @Component({ selector: 'the-app' templateUrl: 'templateFile.html', styleUrls: ['componentStyles.css', 'moreComponentStyles.css'] }) export class TheAppComponent {} Now, what if I want to write these styles with SASS? I know I would need to use Gulp or Grunt to transpile the SCSS stylesheets to plain CSS. But this makes me confused on

关于node.js和gulp配置环境问题

你。 提交于 2019-12-08 16:36:31
关于node.js和gulp配置环境问题 前段时间接触ajax的时候发现笔记本的配置环境出了问题,很不方便。用apache配置略繁琐,考虑到不是大型项目,用node.js配置就够了。查找资料后研究了好久,总是安装好了,记录一下步骤,记忆不好以防日后需要。 1.安装node.j 在node.js官网根据情况下载(Windows 系统 (.msi) 64位),选择安装路径后一直next下去 ,最后点击 Finish完成。 2.打开cmd 开始 》输入“cmd” ,打开。输入“path” 查看环境变量是否已安装了node.js。 然后输入”node –version”、”npm -version” 查看node.js版本 3.新建存放文件 先在E盘(任意盘)新建一个“webserver”(任意命名)的文件,然后在里面新建一个src文件。再src里面新建5个文件并命名。 将gulp配置文件package.json、gulpfile.js 等文件下载后放到“webserver”下面。 gulpfile.js配置文件下载 然后在cmd输入“npm install gulp -g” 回车安装插件。 安装之后再输入npm install回车。 安装后,再看下webserver文件里面会多出一个‘’node_modules”文件,总算安装成功。 4.打开webserver gulpfile

Gulp command opens gulp.js in notepad instead of running it

雨燕双飞 提交于 2019-12-08 16:17:04
问题 I installed it correctly I think. My package.json { "name": "my-project", "version": "0.1.0", "devDependencies": { "gulp": "^3.8.11", "gulp-concat": "^2.5.2" } } my gulp.js var gulp = require('gulp'); var concat = require('gulp-concat'); gulp.task('scripts', function() { return gulp.src('js/*.js') .pipe(concat('main.js')) .pipe(gulp.dest('build/js')); }); gulp.task('default', ['scripts']); my folder are as follow : ROOT/package.json ROOT/gulp.js ROOT/node-modules/ <-- my modules are here ROOT

Cannot read property 'main' of undefined

ぐ巨炮叔叔 提交于 2019-12-08 16:09:40
问题 So my project structures is I have a src and www directory in my root ./ , which also contains my bower.json , gulpfile.js , and .bowerrc with the directory set to ./www/bower/ . I have an index.html in my ./src and I've setup a gulp task that pipes it through wiredep and out to the ./www where the bower packages are. Unfortunately it adds all the dependecies as if it's in the ./src directory so all of them are prefixed like ../www/bower/ which does work as the final index.html ends up in the

Why might I be getting “task completion callback called too many times” in gulp?

亡梦爱人 提交于 2019-12-08 15:56:07
问题 Given the following gulp task, why might I be getting the following error? Error: task completion callback called too many times function myTask(options, cb) { // cb is the gulp cb var serverInstance = http.createServer(dispatch({ /*routes*/ })); serverInstance.listen(options.port, function() { cb(); // Stack trace identifies this line as throwing the error }); } function partial(fn) { var args = Array.prototype.slice.call(arguments, 1); return function() { return fn.apply(this, args.concat