The current documentation says, that I only need the files under public/build, created with ./node_modules/.bin/encore production, when I want to deploy for production. But also to add public/build to git ignore. Do I have to copy the content of public/build manually?
In Symfony3 my deploy looked like that:
git pull
bin/php bin/console cache:clear --env=prod --no-debug
bin/php bin/console assets:install --env=prod
bin/php bin/console assetic:dump --env=prod --no-debug
FYI, Using assetic was the »old« way, and starting Symfony 2.8 Assetic is not included in the standard framework anymore (but you can still add it).
Regarding public/build you misunderstood it a bit - the actual source files should be somewhere else, for example in assets/css/app.scss and assets/js/app.js. Using Webpack Encore, running ./node_modules/.bin/encore production will minify, uglify, etc (whatever you configure in webpack.config.js) these source files and then copy the generated files to public/build. So public/build will only contain the generated stuff and thus can be safely added to .gitignore (but you also need to run the encore script in production).
Your JavaScript file (i.e. in this case app.js) should include
require('../css/app.scss');
so that the app.scss is actually a dependency of app.js and you only need to tell the webpack.config.js to include the JavaScript file. The basic configuration of webpack.config.js might look like this:
// webpack.config.js
var Encore = require('#symfony/webpack-encore');
Encore
// this will put all your compiled stuff into public/build, that’s
// why you can put this into .gitignore, because you can re-build this
// from the source files.
.setOutputPath('public/build/')
// the public path used by the web server to access the previous directory
.setPublicPath('/build')
// this will create public/build/app.js, and also public/build/app.css
// since the scss file is a dependency of app.js
.addEntry('app', './assets/js/app.js')
// allow sass/scss files to be processed
.enableSassLoader()
[...]
;
// export the final configuration
module.exports = Encore.getWebpackConfig();
You can find some more explanation under https://symfony.com/doc/current/frontend/encore/simple-example.html (first example) or https://symfony.com/doc/current/frontend.html (overview)
Related
I am using esbuild to build a vscode extension. The build gives a warning like:
✨ Done in 1.28s.
This extension consists of 7026 files, out of which 5430 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
DONE Packaged: /my-vscode/my-vscode-0.0.2.vsix (7026 files, 8.43MB)
I am not sure I node_modules need to be added to .vscodeignore ? when I tried doing it and installed the plugin, I get an error that my commands are not found ..
Any thoughts ?
I want to fork buildroot, add a custom package, add the package's source directly in-tree, and have buildroot use the in-tree source to build the custom package. I've done that, following chapter 17 of the buildroot user manual, but buildroot doesn't seem to be picking up local changes that I've made.
For example, I built the entire image, and it also built my custom application. Then I went into the source for my custom application and added an intentional syntax error -- but then I ran make again and it happily generated an image using the old version of my custom app.
How do I tell buildroot to look for local source modifications, even if it already has a cached build of the package with a matching version?
These are the new files which I have added to my buildroot fork:
buildroot/
package/
customapp/
customapp.mk
Config.in
customapp/
configure.ac
Makefile.am
README
src/
main.c
Makefile.am
(I also edited buildroot/package/Config.in so that it sources the buildroot/package/customapp/Config.in file. All the Config.in stuff is just a simple boolean to enable customapp, and they work fine, so I'll omit them from this question.)
Here are the contents of the build-related files:
buildroot/package/customapp/customapp.mk
CUSTOMAPP_VERSION = 0.1
CUSTOMAPP_SITE = customapp
CUSTOMAPP_SITE_METHOD = local
CUSTOMAPP_AUTORECONF = YES
$(eval $(autotools-package))
buildroot/customapp/configure.ac
AC_INIT([customapp], [0.1], [name#email.tld])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
buildroot/customapp/Makefile.am
SUBDIRS = src
dist_doc_DATA = README
buildroot/customapp/src/Makefile.am
bin_PROGRAMS = customapp
customapp_SOURCES = main.c
Section 8.3 of the buildroot manual explains how to rebuild a single package. The easiest way is with [package name]-rebuild target. In your case it would be:
make customapp-rebuild
You may want to also trigger the buildroot post build actions to rebuild the target device file system images after your package re-build is complete:
make target-post-image
To rebuild a buildroot package, you have to remove the stamp files in output/build/customapp-version/.stamp*. The easiest way is to remove the whole build directory.
Buildroot relies only on the .stamp files for understanding what needs to be rebuild.
My processing units have runtime dependencies and if I put them into $GigaSpaces_root/lib/required then my PUs deploys fine.
But I'd like to keep GS root distr unattached (even owned by root) and put these libs into some other custom dir. But I can't find a way to configure GS to look for dependencies in my custom dir. PRE_CLASSPATH, CLASSPATH, POST_CLASSPATH don't help. Other useful variables are overwritten by setenv.sh on GS initialization. What I'v done:
strings -a /proc/{GSC_PID}/environ | grep tmp
POST_CLASSPATH=/tmp/lib
PRE_CLASSPATH=/tmp/lib
CLASSPATH=/tmp/lib
The question is how to configure GS to look for libraries in custom directory?
Solution is here: http://docs.gigaspaces.com/sbp/moving-into-production-checklist.html#runtime-files-location
export GSC_JAVA_OPTIONS="$GSC_JAVA_OPTIONS -Dcom.gs.pu-common=YOUR_DIR_FOR_LIB"
I have a local javascript in my application that i want to include in my ember-cli application.
it is called carrotsearch.foamtree.js
In order that it will be included i put it under vendor\foamtree\carrotsearch.foamtree
and in the app.js i write
import CarrotSearchFoamTree from 'foamtree/carrotsearch.foamtree'
the problem is that i get an error
===== 1 JSHint Error
Build failed. ENOENT, no such file or directory
'C:\Users\davidga\Desktop\ember\nextgen\tmp\tree_merger-tmp_dest_dir-37cYqLzL.tmp\foamtree\carrotsearch.foamtree.js'
File: foamtree/carrotsearch.foamtree.js Error: ENOENT, no such file or directory C:\Users\davidga\Desktop\ember\nextgen\tmp\tree_merger-tmp_dest_dir-37cYqLzL.tmp\foamtree\carrotsearch.foamtree.js'
at Object.fs.statSync (fs.js:689:18) at addModule
(C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\no
de_modules\broccoli-es6-concatenator\index.js:83:46) at addModule
(C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\no
de_modules\broccoli-es6-concatenator\index.js:126:9) at
C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\node_modules\
broccoli-es6-concatenator\index.js:59:7 at tryCatch
(C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\nod
e_modules\rsvp\dist\commonjs\rsvp-internal.js:163:16) at
invokeCallback
(C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-c
li\node_modules\rsvp\dist\commonjs\rsvp-internal.js:172:17) at
publish
(C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\node
_modules\rsvp\dist\commonjs\rsvp-internal.js:150:13) at flush (C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\node_m
odules\rsvp\dist\commonjs\rsvp\asap.js:51:9) at
process._tickCallback (node.js:419:13)
I thought that the problem is maybe bower related so i followed the following post how to include a private local file in javascript project using bower
The problem is that neither
"foamtree": "foamtree/carrotsearch.foamtree.js"
nor
"foamtree": "vendor/foamtree/carrotsearch.foamtree.js"
works.
What may i do?
Thanks,
David
I found an answer.
In brocfile.js we can add the line
app.import('vendor/foamtree/carrotsearch.foamtree.js')
I don't know if this is an optimal anser but it works
Update:
This solution is stated in the ember-cli documentation
http://iamstef.net/ember-cli/#managing-dependencies
If you don't need them to minified in your vendor.js file you can put them in the public/js and then include it as a normal script file in app/index.html. I use this method for some libraries like moment.js.
The public folder gets directly copied to your site root during the build.
I have the following structure:
/lib
/ myfile.js.cofee
/ secondfile.js
/src
and i would like to compile them into
/lib
/ myfile.js.cofee
/ secondfile.js
/src
/ awesomefile.min.js
I have read about Cakefiles, but i'm not sure how to exactly do this.
Thanks,
Mike
If you happen to be using something based on connect (e.g. express), I'd recommend using connect-assets. If not, then grunt may be a good bet, as was previously suggested. If you'd like to do this yourself using a Cakefile, here is one approach you could use:
Note that the convention is to build from src to lib (which is the reverse of what you stated in the question). I'll use that convention below, but you can easily switch it back if needed.
$ npm install snockets
place the following in src/awesomefile.coffee:
#= require secondfile.js
#= require myfile.js.coffee
create a Cakefile with the following:
fs = require 'fs'
Snockets = require 'snockets'
NAME = 'awesomefile'
INPUT_FILE = "src/#{NAME}.coffee"
OUTPUT_FILE = "lib/#{NAME}.min.js"
task 'build', 'Build lib/ from src/', ->
snockets = new Snockets()
js = snockets.getConcatenation INPUT_FILE, async: false, minify: true
fs.writeFileSync OUTPUT_FILE, js
task 'clean', "remove #{OUTPUT_FILE}", ->
fs.unlinkSync OUTPUT_FILE
Now you can just do:
$ cake build
and that will create a lib/awesomefile.min.js.
You can have the files in src track their own dependencies, or you can list the order to be included in a single file like I've done above. For more, you can check out the snockets repository. Also note that the compiling chapter chapter of The Little Book on CoffeeScript is a good resource for learning about cake files.
Might not be the exact answer you expected.
Grunt.js at www.gruntjs.com is a very helpful buildtool and certainly includes a lot of stuff that you need to do on a daily basis with a webproject.