require

import CSS and JS files using Webpack

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a directory structure like this: and inside node_modules: >node_modules >./bin >webpack.config.js >bootstrap >bootstrap.css >bootstrap.js I need to generate separate CSS and JS bundles like this: custom-styles.css, custom-js.js, style-libs.css, js-libs.js where style-libs and js-libs should contain syles and js files of all libraries like bootstrap and jQuery. Here's what I have done so far: webpack.config.js: const path = require('path'); const basedir = path.join(__dirname, '../../client'); const HtmlWebpackPlugin = require('html

ReferenceError: describe is not defined NodeJs

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to define some endpoints and do a test using nodejs . In server.js I have: var express = require('express'); var func1 = require('./func1.js'); var port = 8080; var server = express(); server.configure(function(){ server.use(express.bodyParser()); }); server.post('/testend/', func1.testend); and in func1.js : var testend = function(req, res) { serialPort.write("1", function(err, results) { serialPort.write("2" + "\n", function(err, results) { }); }); }); exports.testend = testend; Now in test.js I am trying to use this endpoint:

What are the purposes of vinyl-buffer and gulp-streamify in gulp?

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: As the documentation says, they both deal with transforming non-stream plugins to stream. What I try to understand is, if I can use the .pipe() method on something, doesn't it mean it's a stream? If so, what do I convert to what here? vinyl-source-stream example: (from: https://www.npmjs.com/package/vinyl-buffer ) var browserify = require('browserify') var source = require('vinyl-source-stream') var buffer = require('vinyl-buffer') var uglify = require('gulp-uglify') var size = require('gulp-size') var gulp = require('gulp') gulp.task('build

I am struggling with the requirejs optimizer and non AMD modules

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am struggling with the requirejs optimizer. This code will work if I just load it in the browser without optimization. If I run the optimizer I get : ENOENT, no such file or directory 'C:\Users\dev\checkout\src\main\webapp\resources\scripts\ json2.js' In module tree: main This is the code requirejs.config({ paths : { jquery : "lib/jquery", bootstrap : "lib/bootstrap", modals : "lib/modals", tablesort : "lib/tablesort", json2 : "lib/json2" }, shim : { "bootstrap" : [ "jquery" ], "modals" : [ "jquery" ], "tablesort" : [ "jquery" ], "json2" :

Unexpected “Uncaught TypeError: XXX is not a constructor” errors with Babel and ES6

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am giving a try to Webpack, and am giving a try to the instructions in this tutorial , give or take a few custom things. This is simple code, really, but I'm quite puzzled about this error, and feel this is something silly that I missed. I defined two ES6 classes, each corresponding to a Handlebars template, and my app's entrypoint is supposed to replace the placeholder HTML in the index file by their contents: Entrypoint: import './bloj.less' // If we have a link, render the Button component on it if (document.querySelectorAll('a').length

Require.js ignoring baseUrl

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: OK this is driving me crazy so maybe someone can point me in the right direction... I'm using the latest require.js combined with jquery as my module loader. I am using the data-main attribute to point to a config file with a baseUrl . When I try to load a module the baseUrl is ignored and require is attempting to load from the same location as main.js . /js/main.js require.config({ baseUrl: '/js/vendor/' }); /path/to/page.html <script data-main="/js/main" src="/js/vendor/require-jquery.js"></script> <script> require(['jquery', 'bootstrap'],

How to use blueimp-file-upload with webpack?

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using blueimp-file-upload in my website, and I'm using webpack to organize my js code. I installed blueimp-file-upload and jquery.ui.widget from NPM npm install --save blueimp-file-upload npm install --save jquery.ui.widget and I require blueimp-file-upload in my entry file require('blueimp-file-upload') but when I run webpack, I get thie error: ERROR in ./~/blueimp-file-upload/js/jquery.fileupload.js Module not found: Error: Cannot resolve module 'jquery.ui.widget' in E:\app-parent\cooka-common-web\src\main\resources\static\node_modules

ruby LoadError: cannot load such file

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I require a file, for example (called st.rb): require 'rubygems' require 'mongrel' class TestHandler < Mongrel::HttpHandler def process(request, response) response.start(200) do |head, out| head["Content-Type"] = "text/html" out.write "Hello, World!\n" end end end in irb I get: >> require 'st.rb' LoadError: cannot load such file -- st.rb from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from (irb):3 from /usr/local/bin/irb:12:in `<main>' I

SASS, Rails 3.1: Loading stylesheets in vendor/assets

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm using SASS to load stylesheets in a Rails 3.1(sass-rails 3.1) app. For example, sass partials in app/assets/stylesheets are loaded using @import in application.sass - @import "pages/common" @import "pages/**/*" @import "jquery-ui.css" Now, I also want to load vendor/assets/stylesheets . Note that I'm not using require vendor , as @import pages/* seems to be the sass recommended way of doing it. Files here will be css , and not sass or scss . I cannot use @import ../../../vendor/assets/stylesheets/* as it works only for sass and

Javascript require() function giving ReferenceError: require is not defined

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Basically, I am using javascript to scrape data from Google Play store using: 1-Request 2-Cheerios 3-QueryString I used Google Market API from Github which uses require as following: var request = require('request'); var cheerio = require('cheerio'); var qs = require('querystring'); But I am getting the following ReferenceError: require is not defined ... So, I don't have require in javascript which is either new for me or this is something out of the ordinary. 回答1: RequireJS is a JavaScript file and module loader. It is optimized for in